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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using time as criteria

Status
Not open for further replies.

tjs32

Programmer
Jun 21, 2004
26
AU
I know that this is probably a very basic question but I can't seem to get it right.

I want to test data against a time 12.00 midday, sometimes it works, sometimes it doesn't. I think that it is not seeing the AM/PM. Can anyone point me in the right direction.

if my start time is say 9.00AM it skips to the else statement

Here is my code

Dim x As Date
Dim y As Date

If Me.StartTime < "12.01PM" Then
x = Me.StartDate - 1
Else
x = Me.StartDate
End If

If Me.EndTime >= "12.01PM" Then
y = Me.EndDate
Else
y = Me.EndDate - 1
End If

Thanks
 
Thank you for your prompt response.
So time needs to be treated the same as a date? How does it differentiate between AM & PM?

Would it be #12:01PM#?

 
If you do not specify AM or PM then 12:01 is 1 minute past midday. 1 minute past midnight would be 00:01.
You can use #12:01PM# if you prefer that notation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top