Google Answers Logo
View Question
 
Q: Create update query in MS Access ( No Answer,   2 Comments )
Question  
Subject: Create update query in MS Access
Category: Computers > Programming
Asked by: jrwelch-ga
List Price: $5.00
Posted: 20 Mar 2005 16:13 PST
Expires: 19 Apr 2005 17:13 PDT
Question ID: 497730
I'm looking for specific instructions on how to create a query in
Microsoft Access. Here's what I need the query to do:

I have a database with two tables, one called "Registration" and one
called "StudentOrganizations"

Basically, I have a web page form that dumps information into my
"Registration" table. Both of the tables have the same field names
(with the exception of the primary key), but the information is just
being updated. So when the "Art Club" updates their contact
information into the "Registration" table, I want the query to update
the "Art Club" listing in the "StudentOrganizations" table from the
"Registration" table.

Table and Fields
Table: REGISTRATION
Fields: RegID (primary key), OrgName, OrgMission, StudentLeader1,
SL1Email, SL1Phone, FacultyAdviser, FAEMail, FAPhone

Table: STUDENTORGANIZATIONS
Fields: OrgID (primary key), OrgName, OrgMission, StudentLeader1,
SL1Email, SL1Phone, FacultyAdviser, FAEMail, FAPhone

The primary keys in the databases won't match, but the OrgName field
will be identical in both tables.

How can I create a query that will complete this task?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Create update query in MS Access
From: benball-ga on 21 Mar 2005 06:04 PST
 
Your ideal setup would be

Table: REGISTRATION Fields: RegID (primary key), OrgName, OrgMission,
StudentLeader1, SL1Email, SL1Phone, FacultyAdviser, FAEMail, FAPhone
Table: ORGANISATIONS . Fields : OrgID (primary key), OrgName

Query STUDENTORGANISATIONS (design in SQL mode and set the SQL to)
SELECT Organisations.OrgID, Registration.* FROM Registration LEFT JOIN
Organisations ON Registration.orgName = Organisations.OrgName;

This way,  data is not repeated (ie OrgMission) field does not have to
be stored for each student.
Subject: Re: Create update query in MS Access
From: willcodeforfood-ga on 21 Mar 2005 13:06 PST
 
To see how this query works, open a new query in Access, add no tables
or queries, go to the SQL view and paste in this:

UPDATE REGISTRATION INNER JOIN STUDENTORGANIZATIONS ON
REGISTRATION.OrgName = STUDENTORGANIZATIONS.OrgName SET
STUDENTORGANIZATIONS.OrgMission = [REGISTRATION].[OrgMission],
STUDENTORGANIZATIONS.StudentLeader1 = [REGISTRATION].[StudentLeader1],
STUDENTORGANIZATIONS.SL1Email = [REGISTRATION].[SL1Email],
STUDENTORGANIZATIONS.SL1Phone = [REGISTRATION].[SL1Phone],
STUDENTORGANIZATIONS.FacultyAdviser = [REGISTRATION].[FacultyAdviser],
STUDENTORGANIZATIONS.FAEMail = [REGISTRATION].[FAEMail],
STUDENTORGANIZATIONS.FAPhone = [REGISTRATION].[FAPhone]
WHERE (((REGISTRATION.OrgName)="Art Club"));

You'll need to change "Art Club" to the appropriate OrgName when you
run the update from your web page.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy