dbTalk Databases Forums  

error 3167 "record is deleted"

comp.databases.ms-access comp.databases.ms-access


Discuss error 3167 "record is deleted" in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default error 3167 "record is deleted" - 07-03-2009 , 01:53 PM






using access97 with a table linked to sqlserver 2005
with the following
dim rs as dao.recordset
dim lngActionId as long

Set rs = currentdb.openrecordset("SELECT * FROM
tblNcoActionList")
With rs
.AddNew
!NcNumber = NcNumber
!issueDate = Date
!subject = "Corrective Action"
.Update
.Bookmark = .LastModified
lngActionId = !actionId
End With

set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?

Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-03-2009 , 02:10 PM






Roger wrote:
Quote:
using access97 with a table linked to sqlserver 2005
with the following
dim rs as dao.recordset
dim lngActionId as long

Set rs = currentdb.openrecordset("SELECT * FROM
tblNcoActionList")
With rs
.AddNew
!NcNumber = NcNumber
!issueDate = Date
!subject = "Corrective Action"
.Update
.Bookmark = .LastModified
lngActionId = !actionId
End With

set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've found, sometimes, that the database variable has to be set:

set db = CurrentDb
set rs = db.OpenRecordset("SELECT * FROM tblNcoActionList")

For some reason it doesn't like it when the db variable isn't maintained
until the end of the connection.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSk5JjIechKqOuFEgEQIqnQCgvX2WQlOmD0Bp749cC0nuj0 M4q9MAnRhe
BRgFYflQdLlWc3U9RkZ93WC8
=PLel
-----END PGP SIGNATURE-----

Reply With Quote
  #3  
Old   
Roger
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-03-2009 , 03:08 PM



On Jul 3, 12:10*pm, MGFoster <m... (AT) privacy (DOT) com> wrote:
Quote:
Roger wrote:
using access97 with a table linked to sqlserver 2005
with the following
* * dim rs as dao.recordset
* * dim lngActionId as long

* * Set rs = currentdb.openrecordset("SELECT * *FROM
tblNcoActionList")
* * With rs
* * * * .AddNew
* * * * !NcNumber = NcNumber
* * * * !issueDate = Date
* * * * !subject = "Corrective Action"
* * * * .Update
* * * * .Bookmark = .LastModified
* * * * lngActionId = !actionId
* * End With

* * set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've found, sometimes, that the database variable has to be set:

set db = CurrentDb
set rs = db.OpenRecordset("SELECT * *FROM tblNcoActionList")

For some reason it doesn't like it when the db variable isn't maintained
until the end of the connection.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. *I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSk5JjIechKqOuFEgEQIqnQCgvX2WQlOmD0Bp749cC0nuj0 M4q9MAnRhe
BRgFYflQdLlWc3U9RkZ93WC8
=PLel
-----END PGP SIGNATURE------ Hide quoted text -

- Show quoted text -
same problem when setting 'db'...
and I've decompiled / compacted the mdb... same problem
maybe I need to use a non-autoincrement key, that I can set myself ?

Reply With Quote
  #4  
Old   
John von Colditz
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-03-2009 , 03:19 PM



This is SQL Server, so you have to open recordsets with dbSeeChanges
set.

Set rs = currentdb.openrecordset("SELECT * FROM
tblNcoActionList", dbOpenDynaset, dbSeeChanges)

I'm not sure if that's the problem, but I do know that any dynaset or
action query has to have dbSeeChanges set for SQL Server.

Good luck!


Roger used his keyboard to write :
Quote:
using access97 with a table linked to sqlserver 2005
with the following
dim rs as dao.recordset
dim lngActionId as long

Set rs = currentdb.openrecordset("SELECT * FROM
tblNcoActionList")
With rs
.AddNew
!NcNumber = NcNumber
!issueDate = Date
!subject = "Corrective Action"
.Update
.Bookmark = .LastModified
lngActionId = !actionId
End With

set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?

Reply With Quote
  #5  
Old   
Roger
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-03-2009 , 03:36 PM



On Jul 3, 1:19*pm, John von Colditz <johnv... (AT) earthlink (DOT) net> wrote:
Quote:
This is SQL Server, so you have to open recordsets with dbSeeChanges
set.

Set rs = currentdb.openrecordset("SELECT * *FROM
* tblNcoActionList", dbOpenDynaset, dbSeeChanges)

I'm not sure if that's the problem, but I do know that any dynaset or
action query has to have dbSeeChanges set for SQL Server.

Good luck!

Roger used his keyboard to write :



using access97 with a table linked to sqlserver 2005
with the following
* * dim rs as dao.recordset
* * dim lngActionId as long

* * Set rs = currentdb.openrecordset("SELECT * *FROM
tblNcoActionList")
* * With rs
* * * * .AddNew
* * * * !NcNumber = NcNumber
* * * * !issueDate = Date
* * * * !subject = "Corrective Action"
* * * * .Update
* * * * .Bookmark = .LastModified
* * * * lngActionId = !actionId
* * End With

* * set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?- Hide quoted text -

- Show quoted text -
actually I do use dbSeeChanges, just left it out in my posting

Reply With Quote
  #6  
Old   
hbinc
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-03-2009 , 05:15 PM



On Jul 3, 7:53*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
using access97 with a table linked to sqlserver 2005
with the following
* * dim rs as dao.recordset
* * dim lngActionId as long

* * Set rs = currentdb.openrecordset("SELECT * *FROM
tblNcoActionList")
* * With rs
* * * * .AddNew
* * * * !NcNumber = NcNumber
* * * * !issueDate = Date
* * * * !subject = "Corrective Action"
* * * * .Update
* * * * .Bookmark = .LastModified
* * * * lngActionId = !actionId
* * End With

* * set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?
Hi Roger,

It is not necessary to set the db-variable. Set rs =
currentdb.openrecordset() always works, at least in my applications
(Access97 en up).
However, the assignment of IngActionId = rs!actionId has to be done
before rs.Update.

HBInc.

Reply With Quote
  #7  
Old   
Roger
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-06-2009 , 05:15 PM



On Jul 3, 3:15*pm, hbinc <j.van.g... (AT) hccnet (DOT) nl> wrote:
Quote:
On Jul 3, 7:53*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:





using access97 with a table linked to sqlserver 2005
with the following
* * dim rs as dao.recordset
* * dim lngActionId as long

* * Set rs = currentdb.openrecordset("SELECT * *FROM
tblNcoActionList")
* * With rs
* * * * .AddNew
* * * * !NcNumber = NcNumber
* * * * !issueDate = Date
* * * * !subject = "Corrective Action"
* * * * .Update
* * * * .Bookmark = .LastModified
* * * * lngActionId = !actionId
* * End With

* * set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?

Hi Roger,

It is not necessary to set the db-variable. Set rs =
currentdb.openrecordset() always works, at least in my applications
(Access97 en up).
However, the assignment of IngActionId = rs!actionId has to be done
before rs.Update.

HBInc.- Hide quoted text -

- Show quoted text -
if actionId is an autonumber field, you need to do the .update before
sql server assigns it an ID

Reply With Quote
  #8  
Old   
hbinc
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-07-2009 , 03:41 AM



On Jul 6, 11:15*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
On Jul 3, 3:15*pm, hbinc <j.van.g... (AT) hccnet (DOT) nl> wrote:





On Jul 3, 7:53*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:

using access97 with a table linked to sqlserver 2005
with the following
* * dim rs as dao.recordset
* * dim lngActionId as long

* * Set rs = currentdb.openrecordset("SELECT * *FROM
tblNcoActionList")
* * With rs
* * * * .AddNew
* * * * !NcNumber = NcNumber
* * * * !issueDate = Date
* * * * !subject = "Corrective Action"
* * * * .Update
* * * * .Bookmark = .LastModified
* * * * lngActionId = !actionId
* * End With

* * set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?

Hi Roger,

It is not necessary to set the db-variable. Set rs =
currentdb.openrecordset() always works, at least in my applications
(Access97 en up).
However, the assignment of IngActionId = rs!actionId has to be done
before rs.Update.

HBInc.- Hide quoted text -

- Show quoted text -

if actionId is an autonumber field, you need to do the .update before
sql server assigns it an ID- Hide quoted text -

- Show quoted text -
Hi Roger,

In my Access97 the (autonumber) actionId is available immediately
after the AddNew instruction.
Are we talking about different things?

HBInc.

Reply With Quote
  #9  
Old   
JvC
 
Posts: n/a

Default Re: error 3167 "record is deleted" - 07-07-2009 , 09:42 AM



Roger explained :
Quote:
using access97 with a table linked to sqlserver 2005
with the following
dim rs as dao.recordset
dim lngActionId as long

Set rs = currentdb.openrecordset("SELECT * FROM
tblNcoActionList")
With rs
.AddNew
!NcNumber = NcNumber
!issueDate = Date
!subject = "Corrective Action"
.Update
.Bookmark = .LastModified
lngActionId = !actionId
End With

set rs = nothing

first time, lngActionId is correctly set
2nd time, I get error 3167 when trying to set lngActionId

looking at the table, the data has been created

actionId is an autonumber field
and the table has a unique timestamp field

I've searched and can't find what else could be causing this problem
any ideas ?
A couple of things. Error 3167 is "Application-Defined or
Object-Defined Error in Access 2003/07, so I suspect that is the actual
error that is occuring. Make sure you have the latest version of Jet,
and the latest version of the SQL Server ODBC drivers. You are using an
"ancient" version of Access on a newer version of SQL Server. Your code
works in 2003/07 for me. I would try running the code in the newest
version of Access you can get. If it works, you can break it down from
there.

John

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.