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

I need help with formatting prompts for dates on a query...

Status
Not open for further replies.

Manaburrn

Technical User
Jun 7, 2002
7
0
0
US
I know somebody can help me - I'm trying to pull data off an AS400 database with Access 97 query. When I put the dates into the criteria line (and it gets automatically formatted with the #'s) like this:

Between #5/1/01# AND #5/1/02#

- it works just fine, but if I ask it to prompt me like this:

Between [Enter the Beginning Date] And [Enter the Ending Date]

- it pulls just the records from 5/1/01 and 5/1/02 (two days worth of records).

I've tried formatting the date ever which way, I've tried formatting the prompt variables like this:

Between ("#" & [Enter the Beginning Date] & "#") And ("#" & [Enter the Ending Date]& "#")

- that didn't work. Someone please help me! I've spent way too much time on this!

Thanks,

Raphael Bernard
 
I created a form called FrmDateRange. The form has two text boxes, 'fromdate' and 'todate'.

Then in my query criteria i've referenced this form and its text boxes in the following way.

Between [forms]![FrmDateRange].[FromDate] And [forms]![FrmDateRange].[ToDate]

Hope it sorts your date range problem!
 
chassle - thank you very much! That works, and it seems like the ONLY way it's going to work. Oh, and I have to set the format on the text boxes to LONG DATE or mm/dd/yyyy or else I get strange results.

Thanks again!

Raphael Bernard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top