Setting Value for All Records

S

Stephen

I'd like to write a macro that changes the value of a field in ALL the records of a particular table at once to the same value. For example, changing the date in the "Date" field of all records in a table to "1/1/2004".

I can only seem to create a macro attached to a button on a form that changes the value in that particular record the form is displaying.

Thanks
 
K

Ken Snell

What you want to do is run an update query, not the SetValue macro. An
update query lets you change the values of one or more fields in one or more
tables.

You can run such a query from a macro using the OpenQuery action (if the
query is saved).
--

Ken Snell
<MS ACCESS MVP>

Stephen said:
I'd like to write a macro that changes the value of a field in ALL the
records of a particular table at once to the same value. For example,
changing the date in the "Date" field of all records in a table to
"1/1/2004".
I can only seem to create a macro attached to a button on a form that
changes the value in that particular record the form is displaying.
 
M

M.L. Sco Scofield

You need to make an update query to do this.

Then you can run the query from your button.

Good luck.

Sco

Stephen said:
I'd like to write a macro that changes the value of a field in ALL the
records of a particular table at once to the same value. For example,
changing the date in the "Date" field of all records in a table to
"1/1/2004".
I can only seem to create a macro attached to a button on a form that
changes the value in that particular record the form is displaying.
 
S

sek0910

Thanks everyone

M.L. Sco Scofield said:
You need to make an update query to do this.

Then you can run the query from your button.

Good luck.

Sco


records of a particular table at once to the same value. For example,
changing the date in the "Date" field of all records in a table to
"1/1/2004".
changes the value in that particular record the form is displaying.
 

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