Is there an easy way to change all or selected records in a table

D

dhstein

I have a database that I occasionally will want to change one field in all
records in a table to the same value.

Question 1: Is there a direct way to do this ?

Assuming the answer to Q1 is "No" then I could write a simple routine to
ask for table name, field name and value and then update all records. This
would be a generic routine that I could run against any table and any field.

Question 2:
But if I wanted to be selective about which records, then I'm not sure if I
could run an update against a query (instead of against the table). I'm
trying to make this process as simple as possible. I hope this request is
clear and any advice or information is appreciated.
 
D

Douglas J. Steele

Use an Update query:

UPDATE MyTable
SET MyField = "NewValue"

You can be selective by adding a WHERE clause:

UPDATE MyTable
SET MyField = "NewValue"
WHERE Field1 = 123
 
D

dhstein

Thanks Doug - I'll give it a shot.



Douglas J. Steele said:
Use an Update query:

UPDATE MyTable
SET MyField = "NewValue"

You can be selective by adding a WHERE clause:

UPDATE MyTable
SET MyField = "NewValue"
WHERE Field1 = 123
 

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