Update Multiple Columns in Table

G

Guest

I have a table that has four columns. This table is the result of certain
actions a person takes to need additional training. The four columns are
Name, SSAN, Date, and Reason.

I have several different queries, I'm planning on each one to develop it's
own reason (i.e. reason 1 = A, reason 2 = B, etc). I have this code to update
the SSAN:

Dim MyDb As DAO.Database, MyRec As DAO.Recordset
Set MyDb = CurrentDb
Set MyRec = MyDb.OpenRecordset("Select [SSAN] From
[T-NCMR]")
MyRec.AddNew
MyRec!SSAN = Me.Ctl60_Day_SSAN
MyRec.Update

But I can't figure out how to update everything else without creating
different rows. I appreciate any help I can get with this.

John
 
G

Guest

Sorry, just re-read my post and realize it didn't make any sense. Basic
question:

If you use a query to determine answers to four different questions, how do
you update the four columns of a table without using an append query.

I can't use the append query because this action is an 'onclick' action, and
paperwork is created at the same time.

Above is the code I have for one of the columns getting updated.
Me.Ctl60_Day_SSAN is one of the results from the query (the Social Security
Number).
 
D

Douglas J. Steele

You either use an UPDATE query, or you find the row in the recordset, and
update it.

An Append query definitely is incorrect. Appending adds new rows. Updating
changes existing rows.
 
S

SusanV

UPDATE Table SET Field = 'NewData'

Remove the quotes for numeric, enclose in # for dates.
 
S

SusanV

Don't forget your WHERE clause!
UPDATE Table SET Field = 'NewData' WHERE RecordID = 'CorrectRecord'

(Or whatever)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top