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

Posted on 2011-04-21
Last Modified: 2012-05-11
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.

Question by:Anthony6890
    LVL 119

    Accepted Solution

    use a form to enter the date.
    revised the query criteria to refer to the form's entered date value.
    LVL 44

    Expert Comment

    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

    LVL 9

    Assisted Solution

    by:Armen Stein - Microsoft Access MVP since 2006
    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
    See "Report Selection Techniques".

    LVL 1

    Author Comment

    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!


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now