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

Help with Report Criteria

Status
Not open for further replies.

Tyskie19

Technical User
Feb 13, 2005
14
CA
What I want is a report to return orders between certain dates, I can get the criteria to work if it is = to something, but as soon as I try to use > or < it doesn't work at all.

I have TxtStartDate and TxtEndDate, I want the criteria to be something like this:

TxtStartDate < Order_Date < TxtEndDate
but I cannot get it to work, any ideas?
 
This is the report forum, and I'm a bit unsure where you set criterias in the report. I'm used to using either the WhereCondition of the OpenReport method, or placing it in a query. Basically, for dates in the where condition, it might look like this, provided you've stored dates, and not complete timestamps:

[tt]dim strWhere as string
strWhere = "StartDate Between #" & Me!TxtStartDate & "# AND #" & Me!TxtEndDate& "#"
docmd.openreport "yourreport",acviewpreview,,strWhere[/tt]

If your date settings differ from US, you'll also need to format the date:

[tt]...Between #" & format$(Me!TxtStartDate,"mm\/dd\/yyyy") & "# AND...[/tt]

Roy-Vidar
 
I am doing this in VB, using the openreport cmd, i tried your formula above but it asked for a startdate, and even entering that it still returned all of the records
 
If you're doing this in VB, as opposed to VBA, there are probably somewhat more things to consider... But try using your datefield (order_date?)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top