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

Issue With Date Range For Report 1

Status
Not open for further replies.

nag9127

Technical User
Mar 15, 2007
76
US
I am having a problem with a date parameter for a report. I have my parameters set to >= beginning date and <= ending date, but when I put the same date (mm/dd/yy format) in both fields my report yields nothing. I think this is because the date is time stamped with hours and minutes and perhaps my range is time stamped as well with 00:00:00 even though I am entering the date in mm/dd/yy format. The field my parameter is based on is formatted to short date, but the field still contains the general format information. How can I resolve this, perhaps with a trim function or some other approach. If I put 4/24/07 12:00:00 am to 4/24/07 11:59:59 pm I get today's data, but I don't want to have to do that. I just want to enter 4/24/07 in both fields and see today's activity. Thanks for any help!!!!
 
>= [beginning date] and < (1+[ending date])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV....

I am sure your idea will solve my problem, but for some reason I am getting an error telling me the range is too complex to be evaluated. The "1+" part of the expression is causing this response even though it clearly should yield the desired results. Any ideas to get around this?
 
What is the actual SQL code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya nag9127 . . .

. . . or:
Code:
[blue]   Between [beginning date] And [ending date][/blue]

Calvin.gif
See Ya! . . . . . .
 
Code:
SELECT InventoryTransferTable.*
FROM InventoryTransferTable
WHERE (((InventoryTransferTable.DateTransferred)>=[Beginning Date] And (InventoryTransferTable.DateTransferred)<(1+[Ending Date])));
 
Using "between" rather than >= and < yields the same message pertaining to complex syntax.
 
You may try this:
PARAMETERS [Beginning Date] DateTime, [Ending Date] DateTime;
SELECT InventoryTransferTable.*
FROM InventoryTransferTable
WHERE (((InventoryTransferTable.DateTransferred)>=[Beginning Date] And (InventoryTransferTable.DateTransferred)<(1+[Ending Date])));

Or this:
PARAMETERS [Beginning Date] DateTime, [Ending Date] DateTime;
SELECT *
FROM InventoryTransferTable
WHERE Int(DateTransferred) Between [Beginning Date] And [Ending Date];

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV...

That worked perfectly. I guess Access didn't know what to make of those date fields. Thanks a lot for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top