Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Using InputBox data across multiple queries

Discussion in 'Information Technology' started by GVR_Mike, Jul 28, 2006.

  1. GVR_Mike

    GVR_Mike
    Expand Collapse
    Guest

    I have about 4 different queries in a series of queries that all need
    the same date range that is entered by the user at runtime. I can get
    the start date and end date using 2 InputBoxes in the VBA but I didn't
    want to have to manually write all the query SQL in the VBA and use
    DoCmd.RunSQL, the SQL is very long and cumbersome. I'd rather have it
    neatly packaged in a query and then DoCmd.OpenQuery. Is there a way to
    do this using the data from the InputBoxes? If I just run the queries
    back to back it will have to prompt the user for the dates 4 different
    times which is very annoying.

    thanks.
     
  2. Loading...


  3. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Create a form that you key the dates into.

    Have the queries refer to the date fields on the form:
    Forms!NameOfForm!NameOfTextbox

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "GVR_Mike" <mjbruesch@triad.rr.com> wrote in message
    news:1151619735.574117.292150@d56g2000cwd.googlegroups.com...
    >I have about 4 different queries in a series of queries that all need
    > the same date range that is entered by the user at runtime. I can get
    > the start date and end date using 2 InputBoxes in the VBA but I didn't
    > want to have to manually write all the query SQL in the VBA and use
    > DoCmd.RunSQL, the SQL is very long and cumbersome. I'd rather have it
    > neatly packaged in a query and then DoCmd.OpenQuery. Is there a way to
    > do this using the data from the InputBoxes? If I just run the queries
    > back to back it will have to prompt the user for the dates 4 different
    > times which is very annoying.
    >
    > thanks.
    >
     
  4. Ken Snell \(MVP\)

    Ken Snell \(MVP\)
    Expand Collapse
    Guest

    InputBoxes don't "store" the data for multiple uses outside of the code.
    Build a form that has textboxes on it for the user to put the desired
    values, and then have the query read the values from that form.

    See this article at Allen Browne's site (second method) for an explanation
    of how this is done:
    http://www.allenbrowne.com/casu-08.html

    --

    Ken Snell
    <MS ACCESS MVP>

    "GVR_Mike" <mjbruesch@triad.rr.com> wrote in message
    news:1151619735.574117.292150@d56g2000cwd.googlegroups.com...
    >I have about 4 different queries in a series of queries that all need
    > the same date range that is entered by the user at runtime. I can get
    > the start date and end date using 2 InputBoxes in the VBA but I didn't
    > want to have to manually write all the query SQL in the VBA and use
    > DoCmd.RunSQL, the SQL is very long and cumbersome. I'd rather have it
    > neatly packaged in a query and then DoCmd.OpenQuery. Is there a way to
    > do this using the data from the InputBoxes? If I just run the queries
    > back to back it will have to prompt the user for the dates 4 different
    > times which is very annoying.
    >
    > thanks.
    >
     
  5. GVR_Mike

    GVR_Mike
    Expand Collapse
    Guest

    You guys are the best. It works perfectly. Thanks for the speedy
    replies!!!
     

Share This Page