How do I store an Access parameter when I'm first asked to enter the value?

Hi everyone,

I currently have an Access database that asks for a RUN_DATE parameter where I'm required to input a run date.  My problem is that I don't want to have to continually put that date in when I run a report or look at a query.  Is there any way that I can have access save that value or that I can define my RUN_DATE parameter to a fixed value for the time I want to run it and then I just change that field as I want different dates?

I hope I was somewhat clear on what I want to do.

-Anthony
LVL 1
Anthony6890Asked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
use a form to enter the date.
revised the query criteria to refer to the form's entered date value.
0
 
GRayLCommented:
I would list all your date choices in a combo box - then on making a selection, the click event of the combo box fires and will execute the code according.

If you have a saved query qryFromCombo with SQL along the lines of:

SELECT * FROM myTable WHERE myDate = Forms!myForm!myCombo

In the Click event of the combo:

Private Sub myCombo_Click()
  DoCmd.OpenQuery "qryFromCombo"
End Sub

0
 
Armen Stein - Microsoft Access MVP since 2006Connect With a Mentor PresidentCommented:
One way to have a report prompt the user for criteria before it runs is to open a form from the report's Open event.  Open the form in Dialog mode so that the report waits for the form to be closed or hidden before it proceeds.  That way you can collect criteria from the user and build a Where clause for the report.  It also means that you can call the report directly - you don't need to call it from a form.  And the selection form is reusable - it can be called from multiple reports if they need the same criteria.

Also - since the criteria form is hidden, not closed, each time you run the report in the same session, it remembers your previous criteria.

I've posted examples of this technique on our free J Street Downloads page at http://www.JStreetTech.com/downloads.
See "Report Selection Techniques".

Cheers,
Armen
0
 
Anthony6890Author Commented:
Hey everyone,

Thanks for getting back to me.  Sorry it took so long, I was away for the holiday weekend.

I was able to get it work using the forms as suggested above.

Thanks again!

-Anthony
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.