dynamic submission

C

chris

i have a date form that inputs a from date and a to date.
from this form i want to run a query based on these dates.

the query that it runs is depenedent on where the date
form was opened from.

can i pass a variable into the date form that states which
form it came from?

from there it needs to run the query based on the dates
selected in the date form and run the query sent forth
from the previous form.

any help in this matter is greatly appreciated.
 
P

PC Datasheet

Chris,

Make your date form generic. Put a textbox on it for entering the start date, a
textbox for entering a to date and an OK button. Put this code in the click
event of the button:
Me.Visible = False

You can then open the date form from any other form and run a query with the two
dates as criteria by doing the following:

Build your query and put this expression in the criteria of the date field:
Between Forms!MyDateForm!StartDate And Forms!MyDateForm!ToDate

Put this code in the OnClick event of a button on the form you want to run the
query from:

DoCmd.OpenForm "MyDateForm",,,,,acDialog
DoCmd.OpenQuery "NameOfYourQuery"
DoCmd.Close acForm, "MyDateForm"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top