Discussion:
Getting Intermitant Error in VBA after Upsizing (error 3622)
(too old to reply)
Max Right
2010-03-23 18:15:43 UTC
Permalink
The error I'm getting is: runtime 3622
"You must use the dbSeeChanges option with OpenRecordset when
accessing a SQL Server tables that has an IDENTITY column."

this is the part of my code causing the error....
...
Dim tGC
Set tGC = CurrentDb.OpenRecordset("tblGCdata") <----
....

This error is intermitant and seems to go away when I open the linked
table in access then close it and try running the code again.

what is the reason behind this and what I can do to eliminate this
error?
...perhaps some initial vba code to open and close the table?
Sylvain Lafontaine
2010-03-23 20:16:56 UTC
Permalink
What you have to do is to add this option to the function call. However,
this is the third parameter and in VBA, intermediary parameters cannot be
set by default; so you will also have to specify the second parameter as
well; for example:

Set tGC = CurrentDb.OpenRecordset("tblGCdata", dbOpenDynaset, dbSeeChanges)
--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
Post by Max Right
The error I'm getting is: runtime 3622
"You must use the dbSeeChanges option with OpenRecordset when
accessing a SQL Server tables that has an IDENTITY column."
this is the part of my code causing the error....
...
Dim tGC
Set tGC = CurrentDb.OpenRecordset("tblGCdata") <----
....
This error is intermitant and seems to go away when I open the linked
table in access then close it and try running the code again.
what is the reason behind this and what I can do to eliminate this
error?
...perhaps some initial vba code to open and close the table?
Max Right
2010-03-23 21:36:25 UTC
Permalink
Post by Sylvain Lafontaine
Set tGC = CurrentDb.OpenRecordset("tblGCdata", dbOpenDynaset, dbSeeChanges)
I tried adding these options and as soon as I include that I get a
complie error saying variable "dbOpenDynaset" not defined, if I delete
it it say the same thing for "dbSeeChanges"

i am not declaring tCG properly, I'm not too sure about vba syntax so
my declaration for tGC is:

Dim tGC

.. could it be something else?
Sylvain Lafontaine
2010-03-23 21:49:26 UTC
Permalink
If they are not defined, it's because you have a missing reference (DAO?) in
the list of references for the VBA Editor. You could use their numerical
values instead but a better option would be to correct your references.

dbOpenDynaset: 2
dbSeeChanges: 512
--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
Post by Max Right
Post by Sylvain Lafontaine
Set tGC = CurrentDb.OpenRecordset("tblGCdata", dbOpenDynaset,
dbSeeChanges)
I tried adding these options and as soon as I include that I get a
complie error saying variable "dbOpenDynaset" not defined, if I delete
it it say the same thing for "dbSeeChanges"
i am not declaring tCG properly, I'm not too sure about vba syntax so
Dim tGC
.. could it be something else?
Max Right
2010-03-24 00:41:32 UTC
Permalink
Sylvain, I want to thank you for your help my freind, like you said,
the references where not there and as soon as I added them everything
worked!

Loading...