on,before,after date report from query

golgo1

Registered User.
Local time
Today, 12:01
Joined
Feb 8, 2002
Messages
17
Is it possible to use only one report, with one query to show all records with dates:

ON a certain date
AND/OR
AFTER a certain date
AND/OR
BEFORE a certain date
the report draws from query with recDATE as the field with criteria. can I change the recDATE criteria with VB code from a form when user selects ON/BEFORE/AFTER?
Or do I need a query for each, then can I make a single report change data sources by using code?
 
I haven't tried this, but here's a thought.

You could have a combo on your form, with BEFORE, AFTER and ON as a choice and the RecDate (unbound) text.

On a command button, run code to create a variable string criteria.


If Me.Combo = "ON" then

stringexp = =Forms!searchform![RecDate]

If me.combo = "BEFORE" then

stringexp = .......
etc.

Then after the variable is set, run the query where RecDate is set to the variable. or rather, open the ONE report, which uses the recordsource of the query.

Pretty rough thought here, but I think its enough to get you started.
 
As far as determining what the user wants, I can do that. (using radio buttons actually, I think that combo box may work better)
How do I get that criteria string to transfer to the query as a criteria? (semi-new to runtime queries) if I point the query field to the unbound textbox, won't it just look for records with a date that literally matches the equation? won't it use "=Forms!searchform![RecDate]" instead of =Forms!searchform![RecDate] (no quotes)
I tried it and that's what it does, I think I may be doing it wrong. how would I go about it if that's the way to make a 'dynamic query criteria' if you will?
 
Hello,

I am trying to do something very similar. However, I haven't gotten as far as the radio buttons. I want to be able to set up a report based on a query that when selected the user is prompted to choose before or after and then enter the year they want to base it on. Any help would be great.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom