VBA To Update Query

Jaye7

Registered User.
Local time
Tomorrow, 08:04
Joined
Aug 19, 2014
Messages
205
Hi All,
I am new to Access.

I am after a vba script to run an update query.
I have a table named MYOB_Invent.
I have a Query Named MYOB_Update.

The query is showing records where my field named Test1 is null.
I want to update records with null in the field to today's date (the date of the day that it is run) formatted as 18/08/2014 and the field next to it is named Updated (which is yes/no) from un-ticked to ticked for the updated values.

I would like a vba script to automate the process as I want to automate it via a commandbutton for users.
 
You should just be able change your MYOB_Update query to an Update query and in the 'Update To' row for field Test1 write Format(Date(),"dd/mm/yyyy") and in the field 'Updated' write True
All you need to do is run the query using simple VB such as:
Docmd.OpenQuery "MYOB_Update", acViewNormal
or CurrentDb.Execute "MYOB_Update", dbFailOnError

David
 
Thanks for your help, much appreciated
 

Users who are viewing this thread

Back
Top Bottom