Pages

Showing posts with label Update Table using Query. Show all posts
Showing posts with label Update Table using Query. Show all posts

Tuesday, December 27, 2011

Update Table using Query

If you want to make the changes in the existing table.

Here is the code-


Sub update_table_records_by_query()
DoCmd.SetWarnings (False)
Dim sqlqry As String
'close the table if open
DoCmd.Close acTable, "sales_detail", acSaveYes
' if you want the staff name "a" changed to ashish in the table "sales_detail" and "rep name" is the field name
sqlqry = "UPDATE sales_detail SET [Rep Name] = 'Ashish' WHERE [Rep Name] = 'a'"
DoCmd.RunSQL sqlqry
DoCmd.SetWarnings (True)
End Sub

Download Access Database