Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill field

Status
Not open for further replies.

Ulsterman2

Programmer
May 20, 2005
11
GB
I have a table with approx 20000 records. I have added a new field to the table and want to make the value in that field for all 20000 records =1.

I'm a relative newbie to Access and the above sounds simple but I can't find the necessary command. Any advice would be greatly appreciated.

Thanks
 
Hi

Without using code, you can do this from the query designer, create a new query, select your table into the window when prompted by teh wizard

drag the new field name into the grid in the lower part of the form

from the menu choose Query \ Update (to swith from a Select query to an update query

the grid will change to show "Update to"

enter a 1

run the query

Or you can do this in code with one lone so:

DoCmd.RunSQL "UPDATE MyTable SET MyCol = 1;"

you need to supply the appropriate table name and column name in place of My...

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Or simply create the new field in table design view with default value set to 1.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top