Results 1 to 3 of 3
  1. #1
    DoodlesMcKee is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    May 2012
    Posts
    1

    Need to make two seperate SQL statements work together

    Hi, not much experience in writing SQL statements. These two statements work fine in seperate queries but I need them to work in one query. Can they be put together? I appreciate the help. Thank you.



    WHERE ((([Bid Information].State)=[Forms]![Dashboard].[txtEnterState1] Or ([Bid Information].State)=[Forms]![Dashboard].[txtEnterState2] Or ([Bid Information].State)=[Forms]![Dashboard].[txtEnterState3] Or ([Bid Information].State)=[Forms]![Dashboard].[txtEnterState4]))


    WHERE ((([Bid Information].[Low Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*")) OR ((([Bid Information].[2nd Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*")) OR ((([Bid Information].[3rd Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*"))

    Probably obvious but just in case - "State" is in one field. "Low Bidder", "2nd Bidder" and "3rd Bidder" are all seperate fields in unique records. When we choose the states (up to 4) and a vendor, we need to see the records where that vendor occured, whether in 1st, 2nd or 3rd place AND the other vendors that are in that record.

    Example:

    I want to see bid results in IN, IL, NY and OH where Vendor ABC bid. If they were second, who was first and who was third?

    When I put the two statements in one query, all the states to come through so that's where I'm stuck. I can do some VB (not much but enough to get by on), if that's a better option.

    I thank you for your time.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I'm not sure I understand what you want, but you can try:

    Code:
    WHERE ([Bid Information].State = [Forms]![Dashboard].[txtEnterState1] Or [Bid Information].State = [Forms]![Dashboard].[txtEnterState2] Or [Bid Information].State = [Forms]![Dashboard].[txtEnterState3] Or [Bid Information].State = [Forms]![Dashboard].[txtEnterState4]) AND ([Bid Information].[Low Bidder] Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*" OR [Bid Information].[2nd Bidder] Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*" OR [Bid Information].[3rd Bidder] Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*")
    Make a copy of one of the queries that works, switch to SQL view and replace the WHERE clause with the above clause.

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    What is the point of this:
    WHERE ((([Bid Information].[Low Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*")) OR ((([Bid Information].[2nd Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*")) OR ((([Bid Information].[3rd Bidder]) Like "*" & [Forms]![Dashboard].[txtEnterVendor] & "*"))
    I don't think this filters anything, does it?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Make-shift Work rota in Access
    By jimmy2 in forum Database Design
    Replies: 4
    Last Post: 12-30-2012, 02:29 AM
  2. Replies: 1
    Last Post: 04-26-2012, 08:00 PM
  3. How do I make this super query work
    By SemiAuto40 in forum Queries
    Replies: 5
    Last Post: 04-04-2012, 09:55 AM
  4. Replies: 4
    Last Post: 01-25-2012, 04:38 AM
  5. make Add Record button work
    By janjan_376 in forum Forms
    Replies: 3
    Last Post: 06-05-2009, 04:22 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