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

datetime(Repost)

Status
Not open for further replies.

wdu94

Programmer
Aug 15, 2001
61
0
0
US
Hello,

I have the problem for the format date time. In the forms I set up "Forms!PickDates!TimeOut" is (1:00-12:00 am, or pm), but in the "qrySCHEDULE", I set up "RESERVE_TIME_IN" is (1:00-24:00). The question is I don't know how to format them and compare the time. Please help me out.
Thank you very much for your kind help.
Wdu

The following are my code:

If (Forms!PickDates!End = DLookup(&quot;[RESERVE_DATE_IN]&quot;, &quot;qrySCHEDULE&quot;, &quot;[VEHICLE_ID]=&quot; & Me![VEHICLE_ID]) And Forms!PickDates!Start = DLookup(&quot;[RESERVE_DATE_OUT]&quot;, &quot;qrySCHEDULE&quot;, &quot;[VEHICLE_ID]=&quot; & Me![VEHICLE_ID]) And (Forms!PickDates!TimeOut) <= DLookup(&quot;([RESERVE_TIME_IN])&quot;, &quot;qrySCHEDULE&quot;, &quot;[VEHICLE_ID]=&quot; & Me![VEHICLE_ID])) Then
MsgBox &quot;Your dates conflict with an existing booking. Please consult the list and select another vehicle.&quot;
DoCmd.CancelEvent




 
Some examples

Debug.Print FormatDateTime(dteDate, vbGeneralDate)
Debug.Print FormatDateTime(dteDate, vbLongDate)
Debug.Print FormatDateTime(dteDate, vbShortDate)
Debug.Print FormatDateTime(dteDate, vbLongTime)
Debug.Print FormatDateTime(dteDate, vbShortTime)
Debug.Print Format$(dteDate, &quot;ddd, mmm d, yyyy&quot;)
Debug.Print Format$(dteDate, &quot;mmm d, H:MM am/pm&quot;)
Best Regards

---
JoaoTL
mail@jtl.co.pt
MS Access Site: The Page: moved to
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top