Results 1 to 4 of 4
  1. #1
    nlreid is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    1

    query to add new column using two datasets

    Hi,

    I'm very new to Access so responses in as simple of language as possible would be much appreciated.

    I have two datasets. One has a list of teachers, their ID#s and other variables; one just has a list of the ID#s for teachers who have an A Rating.

    What I need to do is create a new column in the big dataset titled ARated and have a "yes" in the column for all the teachers who have an ARating.

    I know i have to create some type of query or macro to do this, but i'm not sure what/how. if you point me in the right direction (or tell me exactly how to write the syntax into the macro or something) i'm sure i can figure it out.

    I've created a query with the fields in the right place, but I'm not sure how to:
    1- create a new column in the table
    2- have it say "yes" in the new column rather than the A Rating.



    Also, how can I keep this file updated if I have to do this each week with a new dataset?

    Thank you so so so so much


  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    If you eant to keep this file updated, you should not add a column to the table. Instead, you should create a query to get the rated status of the teachers. When you want to see the status, just open the query.

    A sample query is bellow, modify it to meet your needs:

    select distinct teacher.*, isnull(tRate.ID) as Rated from teacher left join tRate on teacher.id=tRate.id

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    I don't fully understand your post. But possibly what you are looking for is a 'calculated field' in a query. In your Access textbook you will want to look this up.

    A query of a table - you can add all the fields of that table; but you can create addition fields in the query (not the table itself) and these are calculated fields. Generally they are indeed calculating among values of other fields. One can use math functions. A very helpful use is with IIF - this is another thing you can look up. For instance:

    ARatingStatus: iif([Rating] like "A","Yes","No")

    Possibly this helps.

  4. #4
    KathyL is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    94
    The question I have for you, is, are you wanting to store a “yes” in this additional field when you match the two tables? And if yes, why?

    Matching two tables is a simple function of a select query. In the query, the two tables have to be matched on one or more fields; in your case, the one field will be the teacher ID’s. In the top part of the query, you’d have a line connecting IDs in one table to the IDs in the other table. The criteria for selecting records in this query would be teachers who have an A Rating. (You don’t say how teachers are marked with an A Rating, but let’s suppose, you have a field called “Rating”, and the value would be “A” for those teachers. In the query’s criteria, you would simply put “A”.

    You can add one or more calculated fields in your query. Or, if you’re going to use this query as the source to a report, you could put a calculation in a test box on the report, like : =Iif([Rating] ="A","Yes","No")

    Kathy
    College Computer Science Instructor

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

Similar Threads

  1. Replies: 7
    Last Post: 04-27-2010, 02:47 PM
  2. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  3. Add new column in a select query
    By ysrini in forum Queries
    Replies: 3
    Last Post: 02-03-2010, 06:58 AM
  4. Replies: 1
    Last Post: 02-26-2009, 11:31 AM
  5. 2 different fields into 1 column by query?
    By rainxking in forum Queries
    Replies: 1
    Last Post: 06-04-2006, 09:37 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