Results 1 to 3 of 3
  1. #1
    sarsmelt is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    17

    Select Where Query

    I have 2 tables:
    Machines
    ID Machine
    1 AAAAA
    2 BBBBB

    Product_Code_Data
    MM Machine
    1A 12
    2B 10
    These tables have no relationship.

    What I want to do is create a select...from...where query that pulls the name of a machine with the MM#
    Here is the code I'm using

    SELECT Machines.Machine, Machine.ID
    FROM Product_Code_Data, Machines
    WHERE (((Machines.ID)=[Product_Code_Data].[Machine1]))
    UNION ALL
    SELECT Machines.Machine, Machine.ID
    FROM Product_Code_Data, Machines
    WHERE (((Machines.ID)=[Product_Code_Data].[Machine2]));


    When I hit the run button it does nothing. It doesn't give a dialog box or an error at all.

    I have other select where queries in this database and they work wonderfully.
    I'm not sure what I'm doing wrong.

    Thanks in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why are you 'running' a SELECT query? Why work directly with tables and queries? Should work with forms and reports bound to tables/queries.

    This isn't just a SELECT query, it is UNION of SELECT queries. Why don't you use INNER JOIN instead of WHERE? That should be more efficient.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    sarsmelt is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    17
    I've actually changed my mind and decided to go with update queries instead of doing it this way as the reason I'm struggling through this is to make it easier to edit in the long run. It will be much simpler with update queries. I can't believe I didn't think if it before :P
    Thanks for your input though.

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

Similar Threads

  1. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  2. Replies: 1
    Last Post: 05-02-2014, 09:29 AM
  3. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  4. Replies: 7
    Last Post: 05-02-2012, 08:04 AM
  5. Replies: 2
    Last Post: 01-31-2011, 08:31 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