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

date range in query 1

Status
Not open for further replies.

ktighe

Programmer
May 25, 2001
45
0
0
US
I have a query (access2000) that prompts users for a date range. I used the following code in the criteria section of the date field in my query:
Between [Please enter the start date - mm/dd/yy] And [Please enter the end date - mm/dd/yy]

Is there any way to trap this data and store it in a global variable? I'm trying to solve a problem with my report, which is that I'm not supposed to display certain records in the report, but I need to know the total number of records for some calculations (if I use a filter, some records get excluded, and my calculations get screwed up). The only way I could think of to solve this problem is to run the report from two queries, one that filters the data, and one that doesn't. I don't want the user to have to enter the date range twice, though......
Any help would be greatly appreciated!

Kevin
 
How the the heavyweight gurus miss this one?


For the first question. You can't do WHAT you are asking, however you can accomplish the effect by going about it backwards.

In the procedure where you would normally call up the report, add two snippets of code (one for each date). These snippets would just use an input box to prompt the user for the dates, and save them is variables. In your query, reference the variables instead of the Prompts.

On the second issue, there should be no real conflict betwee getting a recordcount and getting specific records from where ever. A (not nice way in my opinion) is just use the DCount function. But you could also generate just a seperate query for the count.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Thanks, Michael. I used a macro to call a function that gets the dates and stores them in global variables. I'm just going to use 2 queries in my report. No problem.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top