Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Union Query (2000)

    Can you have parameters in a Union Query? I have a Union Query as such - Select * from [qryc] UNION Select * From [qryd]; Can I put some parameters in this query. If so, how? I don't know SQL. I want to have the query ask for Status and then a date range using the field Renewal_date. The table for Status is tblSF and the table for Renewal_date is tblAllData. Also, I want them to be able to hit enter at both prompts so they get everything. Is this possible. Thanks for your help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Union Query (2000)

    Option 1:

    Create a parameter query the "normal" way, in design view that will become the first part of the union query.
    When you've tested it, switch to SQL view.
    Remove the semi-colon ; at the end.
    Press Enter, type UNION and press Enter again.
    Leave the window open, and switch to the database window.
    Next, create a parameter query the "normal" way, in design view that will become the second part of the union query.
    When you've tested it, switch to SQL view.
    Copy the SQL to the clipboard (Ctrl+C)
    Switch to the query you created first.
    Make sure the insertion point is at the end, below UNION.
    Paste the SQL of the second query (Ctrl+V)
    You now have the SQL for a union query with parameters.

    Option 2:
    Create a simple union query without parameters.
    Save and close it.
    Create a new query based on the union query, and add criteria with parameters.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •