Results 1 to 4 of 4
  1. #1
    aldridge_p is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12

    WHERE clause - selecting based on values held in a different table

    Apologies for the title, its fairly indescript.

    Scenario

    3 Tables and an SQL query.

    Table 1 (Raw Data)
    Field 1 - identifier key
    Field 2 - Status (Data type = Text/Combo Box (Row Source = SELECT [CI - Status Values].Status FROM [CI - Status Values])
    Field 3 - name
    ..and so on...

    Table 2 (CI - Status Values)
    Field 1 - Status (Data type = Text)

    Table 3 (CI-SV Completed Values)


    Field 1 - Completed Value (Data type = Text)

    Objective:
    Create an sql query to select all fields from [Raw Data] based on the values held in [CI-SV Coompleted Values].[Completed Value].

    I know this is wrong, but my brain has turned to mush and can't for the life of me think where I am going wrong, any help would be appreciated:
    SELECT [Raw data].*
    FROM [Raw data]
    WHERE ([Raw Data].[Status] = [CI-SV Completed Values].[Completed Value]
    ORDER BY [Raw Data].[Name];

    Many thanks in advance.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    SELECT [Raw data].*
    FROM [Raw data] INNER JOIN [CI-SV Completed Values] ON [Raw Data].[Status] = [CI-SV Completed Values].[Completed Value]
    ORDER BY [Raw Data].[Name];
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    aldridge_p is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    Worked a charm cheers Paul.

    Pat

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help Pat, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Selecting Max values
    By gkaro in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 04:07 PM
  2. Selecting records based on particular value
    By usman400 in forum Queries
    Replies: 4
    Last Post: 09-30-2011, 07:58 AM
  3. Selecting multiple values to be used in a report.
    By mnsemple83 in forum Reports
    Replies: 1
    Last Post: 08-12-2011, 05:10 PM
  4. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM
  5. Selecting foreign key values on data entry
    By hardya in forum Access
    Replies: 4
    Last Post: 02-11-2010, 11:56 AM

Tags for this Thread

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