Problem setting a Date range on my query criteria

MsLady

Traumatized by Access
Local time
Today, 05:26
Joined
Jun 14, 2004
Messages
438
I have this criteria which should collect a date range (cboDate and cboDate2), it works well in collecting the date range if i put separate days (like 6/17/2006 and 7/18/2006, it'll collect the data matching those dates), but if i put the same day, say i want to get all the data for 6/17/2006. And cboDate and cboDate2 are both 6/17/2006. With this code, nothing comes up. Can you help me?

Code:
([tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Or 
[tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Is Null) And 
([tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Or 
[tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Is Null)
 
you could do either

([tblJobDetails].[timeIn] Between #" & Format(cboDate, "mm/dd/yyyy) & "# AND #" & Format(cboDate2, "mm/dd/yyyy) & "#)"


or alternatively

([tblJobDetails].[timeIn] >= #" & Format(cboDate, "mm/dd/yyyy") & "# AND [tblJobDetails].[timeIn] <= #" & Format(cboDate2, "mm/dd/yyyy") & "#)"


change you code just to reflect one date only if there the same and do

([tblJobDetails].[timeIn] = #" & Format(cboDate, "mm/dd/yyyy") & "#)"


using like could get you into deep trouble
 
Hi Wayne,
I get alot of syntax errors. Perhaps i forgot to mention that the query above is being done in the Access query design window?
 
Between [Forms]![YourForm]![YourComb] And [Forms]![YourForm]![YourComb2] in the criteria section for your date field
 

Users who are viewing this thread

Back
Top Bottom