update query 101

  • Thread starter Thread starter snlcoy
  • Start date Start date
S

snlcoy

I inherited an Access Database. I need to remove the values of a field
across all the rows in a table with something like "update table set
field=null". I tried to do New Query and got lost very quickly. This has to
be very simple. Where would I type that statement and execute it?
 
Hi,

That is how to do it in SQL View as long as the field allows for nulls.
If you are asking how to do it in the designer search Access's help for
"update query". That will give you a lot of good information.

Clifford Bass
 
Open the query builder.
Select the table (double-click it) to add it to the grid.
Close the table-choice dialog
Double-click the field you want to nullify to add it to the grid.
Drop down the Query Type button (two overlapping windows on the toolbar)
Pick Update query
Type Null in the Update To box.

You can now run this query. To see the SQL, go to View -> SQL View

In VBA, you can do the same thing this way:

Dim strSQL As String
strSQL = "UPDATE MyTable SET MyField = Null"
CurrentDb.Execute strSQL, dbFailOnError

You can also copy & paste the SQL view of the query into the strSQL value
above.
 
Back
Top