Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    40

    Unanswered: dbSeeChanges Problem

    I have successfully been using this audit trail process on my .mdb back-end. I have now upsized my back-end to SQL, and low and behold I get an error on the following in my audit module;

    The error is 3622, and insists I need to use the "dbSeeChanges" option on the "OpenRecordSet"... I've looked at this till I'm blue in the face - can ANYONE help me out here?


    Dim DB As DAO.Database
    Dim sSQL As String

    Set DB = DBEngine(0)(0)

    If bWasNewRecord Then
    ' Copy the new values as "Insert".
    sSQL = "INSERT INTO " & sAudTable & " ( audType, audDate, audUser ) " & _
    "SELECT 'Insert' AS Expr1, Now() AS Expr2, NetworkUserName() AS Expr3, " & sTable & ".* " & _
    "FROM " & sTable & " WHERE (" & sTable & "." & sKeyField & " = " & lngKeyValue & ");"
    DB.Execute sSQL, dbFailOnError
    Else
    ' Copy the latest edit from temp table as "EditFrom".
    sSQL = "INSERT INTO " & sAudTable & " SELECT TOP 1 " & sAudTmpTable & ".* FROM " & sAudTmpTable & _
    " WHERE (" & sAudTmpTable & ".audType = 'EditFrom') ORDER BY " & sAudTmpTable & ".audDate DESC;"
    DB.Execute sSQL, dbFailOnError
    ' Copy the new values as "EditTo"
    sSQL = "INSERT INTO " & sAudTable & " ( audType, audDate, audUser ) " & _
    "SELECT 'EditTo' AS Expr1, Now() AS Expr2, NetworkUserName() AS Expr3, " & sTable & ".* " & _
    "FROM " & sTable & " WHERE (" & sTable & "." & sKeyField & " = " & lngKeyValue & ");"
    DB.Execute sSQL, dbFailOnError
    ' Empty the temp table.
    sSQL = "DELETE FROM " & sAudTmpTable & ";"
    DB.Execute sSQL, dbFailOnError
    End If
    AuditEditEnd = True

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Try:

    DB.Execute sSQL, dbSeeChanges
    Paul

  3. #3
    Join Date
    Jan 2005
    Posts
    40
    I did that, and it worked great...... but don;t I need dbFailOnError as another option as well? How do I show multiple options??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •