Results 1 to 6 of 6
  1. #1
    RogerD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Location
    Ky
    Posts
    27

    Use form?? for date in Multiple queries


    I have a db that is used for forecasting material requirements. There are multiple queries in the db that work great with Click image for larger version. 

Name:	Capture1.PNG 
Views:	9 
Size:	2.1 KB 
ID:	32433. but instead of typing in the date for each query, I would like to use a form?? or whatever works best to only enter the date one time. I have seen threads that almost get me there, and I know it can be done, just don't know how.

    thanks in advance for your help.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    right click on your criteria and select expression builder. Then navigate to the control on your form. Note the form needs to be open for the query to work. You should end up with something that looks a bit like this

    =[Forms]![NameofForm]!NameofControl]

  3. #3
    RogerD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Location
    Ky
    Posts
    27
    thanks for the quick response.
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	9 
Size:	2.5 KB 
ID:	32434
    works great!
    now, I wrote a macro to test if it can be entered once or if it has to be entered multiple times.
    Click image for larger version. 

Name:	Capture3.PNG 
Views:	9 
Size:	4.3 KB 
ID:	32435
    when I run the macro to update 3 queries, I have to enter the date 3 times.
    what do I need to do to only enter the date once?

  4. #4
    RogerD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Location
    Ky
    Posts
    27
    BTW
    This is the first time I have used the expression builder in this way. I have used it in the past multiple times for calculations, but this is the first time using it to call a form.
    thanks for the info!

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    sorry - don't use macros so not sure what a solution might be. If you run a query and the form is open and has not been closed, you should not need to enter the date again. Suggest post a new thread in the macro forum

    Be aware that Date is a reserved word - it means today, suggest rename your control something like txtDate. Using reserved words can result in unexpected errors, often with misleading error messages.

    See this link for a list of reserved words

    https://support.office.com/en-us/art...7-da237c63eabe

    take note in particular para 2

  6. #6
    RogerD is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2014
    Location
    Ky
    Posts
    27
    I read in an earlier post from you, "the form needs to be open", so, I opened the form, entered the date, ran the macro.
    all 3 queries ran with the date entered in the Form.
    I also changed the "Dates" to "TxtDates".
    I was calling the form from the macro before I re-read your post about the form.
    Thanks for your help!!
    the staff that will be using this for MRP, thank you also!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-12-2017, 06:12 PM
  2. Replies: 17
    Last Post: 08-15-2012, 04:27 PM
  3. Opening a form using multiple queries
    By jpeat in forum Forms
    Replies: 5
    Last Post: 01-24-2012, 06:05 PM
  4. multiple queries in form
    By geraldk in forum Forms
    Replies: 5
    Last Post: 12-26-2011, 02:22 PM
  5. Form queries. Multiple checkboxes.
    By radink in forum Queries
    Replies: 4
    Last Post: 04-27-2011, 07:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums