Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with date checking function 1

Status
Not open for further replies.

Tazcat

Technical User
Feb 17, 2003
40
US
Its just too late on Friday before the holiday, and for the life of me, I cannot figure out what is wrong with this piece of code. Any thoughts? Even if its just to tell me what a schmuck I am?

Private Sub Form_Load()
Dim dtDate As Date
dtDate = Now()

If DatePart(&quot;h:mm:ss&quot;, dtDate) > #4:00:00 PM# And DatePart(&quot;h:mm:ss&quot;, dtDate) < #5:00:00 PM# Then
MsgBox (dtDate)
End If
End Sub

thanks!
 
Use Format(dtDate,&quot;h:mm:ss&quot;) instead. It's too close to vacation time for me to figure out why, you'll just have to accept the answer. Hope that helps.

Kevin
 
Kevin, you're brilliant. Thank you so very much. Now I can go home and enjoy the long weekend.

Melanie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top