My audit routine routine fails. Run-time error '3622' "You must use the dbSeeChanges..."

A

Adam

Hi all ,

I have the following code that writes any changes a recordset to another
table so that I can track changes etc. For some reason it is coming up with
the above error. Does anyone know how I can fix this ?

Here's the code:

'
' AUDIT PROCEDURE BELOW
'
Call fOSUserName
'
Dim mydb As DAO.Database
Dim indata As DAO.Recordset
Dim Ctl As Control
'
Set mydb = CurrentDb()
'
Set indata = mydb.OpenRecordset("tblDevMain_Audit")
indata.AddNew
indata("auditdate") = Now()
indata("auditusername") = fOSUserName

' Not Needed as if it is already an autonumber field
' and the AddNew will automatically increment
' indata!Counter = Forms!form1!Counter

' This is bulldozer coding as the form contains
' all sorts of control types

On Error Resume Next
For Each Ctl In Me '<- current form

' this will error if your tblOfficers_Audit table doesn't
' have a field called the same as a Control, or the
' Control doesn't have a Value Property, and so skip

indata(Ctl.NAME) = Ctl.Value

' so look at the next Control and try again

Next Ctl

' reset Error Trap

On Error GoTo 0
indata.Update
'
indata.Close
Set indata = Nothing
Set mydb = Nothing
'


cheers,

Adam
 
R

Rob Waibel

Hey,
The error has to do with Auto-Numbering/increment. I take
it you are connected to SQL database? I do know you can
specify 'dbSeeChanges' in the connection string as an
option. My solution was to create a counters table and
then increment it myself.

Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top