View Full Version : Query based on date ranges supplied by a form


FISHiEE
02-28-2005, 01:40 AM
Hi,

No doubt this is very simple to solve, but I can't find the solution after searching for ages!

I have a form where the user enters a date range, and then I want to search a query on that date range and return information to the user. An extract of the significant code follows:

StartDate = [Txt_Start]
EndDate = [Txt_End]

Set rst = db.OpenRecordset("SELECT * from [qry_ConversianRateSummaryQuotes&Ack] WHERE ((([qry_ConversianRateSummaryQuotes&Ack].[Quotation Sent?]) Between #" & StartDate & "# And #" & EndDate & "#))", dbOpenDynaset)

With this code I get back values from the wrong date range. I realise that I need to somehow convert the data taken from the form into the international date format for use in queries but can't for the life of me work out how to do this! Everything works fine if I hard code a date range rather than taking it from the form, so once I have sorted the conversion everything should be fine.

If anyone can help me out I would be very grateful!

Thanks in advance!

FISHiEE
02-28-2005, 02:36 AM
Found the solution on another site. The code required for the conversion was:

Format$(startDate, "mm/dd/yyyy")