adding dates to a query design automatically

donnycarr

New member
Local time
Today, 00:52
Joined
Oct 5, 2001
Messages
8
I have set up a macro to run several queries. Within the queries are dates which are used in the selection of entries from the database. EG. “Select the entries between this date and that date”
Is it possible to create a switchboard ‘button?’ whereby a user could enter a date into a field and Access would then use this date in the queries before running the macro described above.
From this date I also need Access to automatically work out a period of time before. EG. 4, 12 and 52 week periods. It can use these dates in the selection of entries from the database.

If anyone can help it would be much appreciated.

…Donny
 
Hi Donny

You could create two unbound text boxes on your form, formatted to Date/Time and with an Input Mask:

99/99/0000;0;_

Then reference these two fields in your criteria row within each query:

Forms!frmMyFormName!txtStartDate

Forms!frmMyFormName!txtEndDate

Then when you run your queries, via a macro or VBA coding, the dates will automatically be picked up from these two text boxes.

HTH

Rich Gorvin


[This message has been edited by Rich@ITTC (edited 10-08-2001).]
 
I have managed to…

”set up the unbound text boxes on your form, formatted to Date/Time and with an Input Mask:
99/99/0000;0;_
Then reference these two fields in your criteria row within each query:
Forms!frmMyFormName!txtStartDate”

However there are 2 more things. I want the query to select the records between the above date (which the user inserts when prompted) and the 4, 12, 52 wk periods before this date. I want the query to automatically work this out rather than the user having to work out the dates for the 4 week period etc..
Another thing is, when the macro runs these 12 queries it asks the user to enter the date into the input mask for everyone, once you’ve entered the date can all the queries not just pick up the same one?
Cheers guys,

…Donny Carr



[This message has been edited by donnycarr (edited 10-10-2001).]
 

Users who are viewing this thread

Back
Top Bottom