Run-Time error 3622

S

Sabineke

Hi,

Have a DB with linked tables to a SQL server.

Get following error when I try to delete some records in a table from within
VBA.
The records must match a value in a form "projectnr"

Run-Time Error 3622 : You must use the DBSeechanges option with
OpenRecordset when accessins a SQL server Table that has an IDENTITY column.

Here's my code :

Dim strSQL As String

strSQL = "DELETE TblEF.IDFE, TblEF.IDPFE, TblEF.Titel, TblEF.Finan,
TblEF.POrg " & _
" FROM TblEF" & _
" WHERE TblEF.IDPFE = " & [Forms]![FrmProjecten]![ProjectNr]

DBEngine(0)(0).Execute strSQL, dbFailOnError

Before I made the link to the SQL server tables this code worked in Access
(Tables in same DB)

Can Anyone help me. I'm just a starter on working this way.

Thanks in advance
Sabine
 
B

Brendan Reynolds

Sabineke said:
Hi,

Have a DB with linked tables to a SQL server.

Get following error when I try to delete some records in a table from
within
VBA.
The records must match a value in a form "projectnr"

Run-Time Error 3622 : You must use the DBSeechanges option with
OpenRecordset when accessins a SQL server Table that has an IDENTITY
column.

Here's my code :

Dim strSQL As String

strSQL = "DELETE TblEF.IDFE, TblEF.IDPFE, TblEF.Titel, TblEF.Finan,
TblEF.POrg " & _
" FROM TblEF" & _
" WHERE TblEF.IDPFE = " & [Forms]![FrmProjecten]![ProjectNr]

DBEngine(0)(0).Execute strSQL, dbFailOnError

Before I made the link to the SQL server tables this code worked in Access
(Tables in same DB)

Can Anyone help me. I'm just a starter on working this way.

Thanks in advance
Sabine


Change this line ...

DBEngine(0)(0).Execute strSQL, dbFailOnError

.... to ...

DBEngine(0)(0).Execute strSQL, dbFailOnError Or dbSeeChanges

Although the error message only refers to the OpenRecordset method, the
requirement to use dbSeeChanges under these circumstances also applies to
the Execute method.
 
S

Sabineke

HI Brendan,

Thanks for your help, my problem is solved.

Sabine

Brendan Reynolds said:
Sabineke said:
Hi,

Have a DB with linked tables to a SQL server.

Get following error when I try to delete some records in a table from
within
VBA.
The records must match a value in a form "projectnr"

Run-Time Error 3622 : You must use the DBSeechanges option with
OpenRecordset when accessins a SQL server Table that has an IDENTITY
column.

Here's my code :

Dim strSQL As String

strSQL = "DELETE TblEF.IDFE, TblEF.IDPFE, TblEF.Titel, TblEF.Finan,
TblEF.POrg " & _
" FROM TblEF" & _
" WHERE TblEF.IDPFE = " & [Forms]![FrmProjecten]![ProjectNr]

DBEngine(0)(0).Execute strSQL, dbFailOnError

Before I made the link to the SQL server tables this code worked in Access
(Tables in same DB)

Can Anyone help me. I'm just a starter on working this way.

Thanks in advance
Sabine


Change this line ...

DBEngine(0)(0).Execute strSQL, dbFailOnError

... to ...

DBEngine(0)(0).Execute strSQL, dbFailOnError Or dbSeeChanges

Although the error message only refers to the OpenRecordset method, the
requirement to use dbSeeChanges under these circumstances also applies to
the Execute method.
 

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

Similar Threads


Top