After Update Event Procedure not working after upsizing to sql server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zeeshan7
    New Member
    • Oct 2006
    • 44

    After Update Event Procedure not working after upsizing to sql server

    After Update Event Procedure on a form is not working after upsizing database to SQL server. Anything to add in below code as it generate run time error 3622 "You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column."

    Please help.. thanks

    Code:
     Private Sub Form_AfterUpdate()
         Dim db As Database
    
             Set db = CurrentDb
             db.Execute "INSERT INTO [tblFinding_Backup] " & " SELECT * FROM [tblFinding] WHERE " & " [tblFinding].[ID]=" & Me![ID] & ";"
             Set db = Nothing
    
         End Sub
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Haven't done this myself, but you may need to specify the columns to insert into. You might also be able to use SELECT INTO.

    Comment

    • Zeeshan7
      New Member
      • Oct 2006
      • 44

      #3
      Need some more help to work around regarding error 3622 as stated above.

      Thanks

      Comment

      • DonRayner
        Recognized Expert Contributor
        • Sep 2008
        • 489

        #4
        Originally posted by Zeeshan7
        After Update Event Procedure on a form is not working after upsizing database to SQL server. Anything to add in below code as it generate run time error 3622 "You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column."

        Please help.. thanks

        Code:
         Private Sub Form_AfterUpdate()
             Dim db As Database
        
                 Set db = CurrentDb
                 db.Execute "INSERT INTO [tblFinding_Backup] " & " SELECT * FROM [tblFinding] WHERE " & " [tblFinding].[ID]=" & Me![ID] & ";"
                 Set db = Nothing
        
             End Sub
        Try line 5 like this

        Code:
        db.Execute "(INSERT INTO [tblFinding_Backup] " & " SELECT * FROM [tblFinding] WHERE " & " [tblFinding].[ID]=" & Me![ID] & ";"));, dbopendynaset, dbseechanges)"

        Comment

        • Zeeshan7
          New Member
          • Oct 2006
          • 44

          #5
          Now it gives (Compile error: Syntax error)
          Please advice. Thanks

          Comment

          • Zeeshan7
            New Member
            • Oct 2006
            • 44

            #6
            I have used append query as an alternate.
            Thanks

            Comment

            Working...