Results 1 to 2 of 2
  1. #1
    Dannat is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Jan 2012
    Posts
    18

    if or case statement and how

    if I have one table that has all the names of the cities where an employee can work. The cities are column names. I need to be able to search on these columns depending on what the user inputs. Example:

    The employee says they can work in Ottawa, Toronto and Barry. In the table under those city columns it will have the falue of True in the fileds and all the other will be False.



    Now a new jobs comes in, it goes into a different table and the city column says Ottawa. How do I create a querry to take the "Ottawa" from the second table and find the "Ottawa" Column in the 1st table and see if it is true. If it is then I need the employee name to show. If its false then do nothing.

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Your table structure is not set up correctly. If a person can work in many cities that describes a one-to-many relationship. Additionally, more than one person can probably work in the same city, so you have another one-to-many relationship. The proper structure is as follows

    tblPeople
    -pkPeopleID primary key, autonumber
    -txtFName
    -txtLName

    tblCity
    -pkCityID primary key, autonumber
    -txtCity

    tblCityPeople
    -pkCityPeopleID primary key, autonumber
    -fkPeopleID foreign key to tblPeople
    -fkCityID foreign key to tblCity

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

Similar Threads

  1. CASE STATEMENT or IF-ELSE-THEN? HELP
    By Shakenaw in forum Access
    Replies: 9
    Last Post: 06-08-2015, 11:24 AM
  2. Pass Through Query: CASE statement
    By eww in forum Programming
    Replies: 6
    Last Post: 08-25-2011, 09:06 AM
  3. Help with Select Case statement
    By focosi in forum Access
    Replies: 4
    Last Post: 08-09-2011, 12:01 AM
  4. case statement - multiple columns
    By eddiec in forum Queries
    Replies: 2
    Last Post: 07-05-2011, 03:24 AM
  5. Case Statement Syntax
    By allenjasonbrown@gmail.com in forum Programming
    Replies: 1
    Last Post: 11-16-2010, 07:18 PM

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