jccc
jccc

Reputation: 51

"After Update" data macro runs VBA, but SQL SELECT in that VBA returns the pre-update row

I run a VBA function from an "After Update" data macro via SetLocalVar. This VBA function queries the row that was just updated (taking the table name and a unique ID to select). However, the row that I get is the pre-update row.

So it is as if my function runs before the update, even though it is an "After Update" data macro.

Why is the row not updated by the time my VBA function selects it?

Here is my query:

Public Function addToCache(op, table, primaryKey, primaryId)
  Dim rs As Recordset
  Set rs = MyDB.OpenRecordset("SELECT * FROM " & table & " WHERE " & primaryKey & " = " & primaryId, dbOpenSnapshot)
End Function

Upvotes: 1

Views: 87

Answers (0)

Related Questions