Update Statement VBA Access (1 Viewer)

hazeleyre23

Registered User.
Local time
Today, 06:54
Joined
Apr 6, 2016
Messages
18
Hi,

I am trying to use an UPDATE statement in VBA.

Below is my code, however when I try run it, I am getting an error message.

Code:
currentdb.Execute "Update dbo_Agent_Data set ToDate = #" & me!txtUpdateToDate & "# WHERE id_new = " & me!txtUpdateID

the error message I am getting is:

"You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column"

My Identity column column is ID, this is also my Primary Key. Not sure what I need to do next....

Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:54
Joined
May 7, 2009
Messages
19,249
then add that in your update sttatement:

currentdb.Execute "Update dbo_Agent_Data set ToDate = #" & me!txtUpdateToDate & "# WHERE id_new = " & me!txtUpdateID, dbSeeChanges
 

Ranman256

Well-known member
Local time
Today, 09:54
Joined
Apr 9, 2015
Messages
4,337
docmd.runSql "update dboagent..."
 

Users who are viewing this thread

Top Bottom