UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Runtime Error 3622, Access 2016    
 
   
troybos@gmail.co...
post Mar 26 2020, 02:28 PM
Post#1



Posts: 8
Joined: 15-August 18



I've moved my back-end database to SQL and am having trouble fixing an error that occurs. The error is "You must use the dbSeeChanges option with OpenRecordset when accessing a SQL Server table that has an IDENTITY column. My code copies data from a previous record and puts in a form for a new record. Then a message box asks if you really want to make a copy of the record. If you select no, it runs a SQL string to delete the new record from the table. I get the error when it try to run the following SQL string. This worked fine when it was an Access backend. Can someone point me in the right direction on what I need to change to have this work with SQL?

CODE
Dim strMsg As String
    
    strMsg = "Are you sure you want to copy the report " & Me![AuditReportNumber] & "? "

    If MsgBox(strMsg, vbYesNo) = vbNo Then
        strSQL = "DELETE * " & _
         "FROM [ProjectReports] " & _
         "WHERE [AuditReportNumber]='" & [Forms]![EditReport2]![AuditReportNumber] & "'"

    CurrentDb.Execute strSQL, dbFailOnError
Go to the top of the page
 
GroverParkGeorge
post Mar 26 2020, 03:36 PM
Post#2


UA Admin
Posts: 37,451
Joined: 20-June 02
From: Newcastle, WA


Change this line:

CurrentDb.Execute strSQL, dbFailOnError

To

CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
troybos@gmail.co...
post Mar 26 2020, 04:00 PM
Post#3



Posts: 8
Joined: 15-August 18



Thank you GroverParkGeorge. That did it.
Go to the top of the page
 
GroverParkGeorge
post Mar 26 2020, 04:10 PM
Post#4


UA Admin
Posts: 37,451
Joined: 20-June 02
From: Newcastle, WA


Congratulations on solving the problem.

Continued Success with the Project.

George

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    5th July 2020 - 12:02 PM