Results 1 to 2 of 2
  1. #1
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142

    Setting Query Parameters From VBA OR Form Fields

    I have a main parameter query that pulls together 7 other paremter queries. Several of these 8 queries require the same 2 parameters. I have need to use this query as a recordsource for a subform, and also as a recordsource for a report. The report can be called from many places in the application. I'd like to be able to open the report without requiring that a specific form having to be open when I open it. I'm thinking that I have to copy all 8 of my queries and modify them to use form Fields as parameters. But now I would have 16 queries doing almost the same thing, almost feels like a redundant waste of space. If I have a query that looks up 'parameters' from an open form is there a way to call that same query from VBA and set those form variables the same as I could set actual parameters variables from qdef?



    I know how to make queries that use Fields from open forms as parameters.

    I know how to use VBA to pragmatically set parameters before opening the query.


    Just had a thought... Maybe the queries do use a form Fields for parameters and when necessary I can open a form hidden then open the report for the user to view. Can you open a form hidden?

  2. #2
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    Can you open a form hidden?
    yes, look at the window mode argument for the docmd.openform method.
    https://msdn.microsoft.com/en-us/vba...-method-access

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

Similar Threads

  1. Query asks parameters for Calculated Fields
    By Athar Khan in forum Queries
    Replies: 7
    Last Post: 03-14-2017, 12:53 AM
  2. Replies: 2
    Last Post: 11-03-2015, 08:56 AM
  3. Replies: 1
    Last Post: 06-06-2014, 08:26 AM
  4. Replies: 1
    Last Post: 03-27-2014, 06:42 AM
  5. Replies: 4
    Last Post: 10-24-2013, 12:32 PM

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