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!

Date Range Syntax Error

Status
Not open for further replies.

LysaTigger

Technical User
Jan 28, 2005
12
0
0
CA
Hi,
I have a syntax error and I don't know how to fix it.
I am trying to filter a report based on a date range.
Here is the code that I have attributed to a cmdbutton in a form to filter the report based on a date range.

DoCmd.OpenReport "rptRequestDate", acViewPreview, , "[StartDate] >= #" & Me![txtFromDate] & #" and <= #" & Me![txtToDate] & "#"

Please let me know where the syntax error is.
Thanks,
Lysa
 
What is less than or equal to the txtToDate control? The same date field?

[tt]"[StartDate] >= #" & Me![txtFromDate] & #" and [StartDate] <= #" & Me![txtToDate] & "#"
[/tt]

Roy-Vidar
 
DoCmd.OpenReport "rptRequestDate", acViewPreview, , "[StartDate] Between #" & Me![txtFromDate] & "# and #" & Me![txtToDate] & "#"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top