Create an append query in visual basic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm just starting out in Access and want to change all records in a field
from "Yes" to "No" using vb and not use an append query. Then I can use a
button on my form to print the report based on the query and before returning
to the form reset the field.
 
I assume you are looking for update query and not Append query.
You can run both using VBA

Docmd.OpenQuery "QueryName"
will run the query that update all the fields from Yes to No

Or
Docmd.RunSql "UPDATE TableName SET FieldName = False WHERE FieldName =True"

=====================================================
You might want to set the warnings to false before running the update sql,
so the user wont be prompt with a message saying how many records will be
updated

Docmd.SetWarning False
' Run here the query or SQL
Docmd.SetWarning True
 
Back
Top