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!

Applyfilter problem

Status
Not open for further replies.

MrM121

Programmer
Aug 21, 2003
83
GB
Does anyone know how to do a date search (single date and range) when the format of the date is dd/mm/yyyy (UK date format). Whenever I enclose the date in #, the date is converted to US style, and so does not correctly filter the form.

Thanks
 
Simply use the Format function:
Me.Filter = "[field date]=#" & Format(Me![control date], "m/d/yyyy") & "#"
Same sort of thing for range:
Me.Filter = "[field date] Between #" & Format(Me![control startdate], "m/d/yyyy") & "# And #" & Format(Me![control enddate], "m/d/yyyy") & "#"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for that. In the end I had already done that, but I wasn't too sure if there was another way around it. I noticed that was happening with the query, but wasn't too sure what the function was to convert it.

Cheers,

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top