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

Subform filter between dates not working

Status
Not open for further replies.

ali32j

Technical User
Apr 23, 2007
97
GB
Hi All

I am trying to filter a subform based on between dates, i enter 2 dates, using a pop up calender to select the dates to filter to, and pressing a apply command button which runs the below code, only problem is, it does nt filter to what it should, not really sure why....both the text boxes are of the format "Short Date"

SUbform is based on a query from 2 tables, all with dates entered in short date format

Code is:
Me!frmVisitReport.Form.Filter = "AppointmentDate BETWEEN #" & Text48 & "# AND #" & Text50 & "#"
Me!frmVisitReport.Form.FilterOn = True
Me.frmVisitReport.Form.OrderByOn = True

cant even work out what its filter to.... it should return maybe 5 or 6 records, but instead is returning over a hundred which are not within the dates asked...


Appreciate if anyone can shed any light on this

Ali
 
How are ya ali32j . . .

Perhaps:
Code:
[blue]Me!frmVisitReport.Form.Filter = "AppointmentDate BETWEEN #" & Format(Text48, "mmm dd,yyyy") & "# AND #" & Format(Text50, "mmm dd,yyyy") & "#"
[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Use the ANSI standard like date format:
Me!frmVisitReport.Form.Filter = "AppointmentDate BETWEEN #" & Format(Text48, "yyyy-mm-dd") & "# AND #" & Format(Text50, "yyyy-mm-dd") & "#"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV / Aceman

Thanks they worked great, could you explain why? not really sure in the details of differences between my code and yours...

Appreciate your help once again!!

Ali
 
It's a matter of ambiguity between dd/mm and mm/dd

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top