A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

@@'IDENTITY Object problem - Help!



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2004, 07:15 PM
Brian
external usenet poster
 
Posts: n/a
Default @@'IDENTITY Object problem - Help!

I'm trying to retrieve the autonumber field after an
insert and have tried the following different versions

Set objRecordset = objConnection.Execute("SELECT
@@IDENTITY")
Set rsNewID = objConnection.Execute("SELECT @@IDENTITY")
Set rsNewID = db.OpenRecordset("SELECT @@Identify")
Set rsNewID = db.OpenRecordset("GetBookingID")
Set rsNewID = commInsert.Execute("SELECT @@IDENTITY")

but get either Object Variable or with block variable not
set or Object Required.

What do I need to do? Thanks
  #2  
Old May 3rd, 2004, 03:02 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default @@'IDENTITY Object problem - Help!

See my code posted in the thread "IDENTITY started by Kate about 2 hours
after your thread (in GettingStarted or Queries).

--
HTH
Van T. Dinh
MVP (Access)


"Brian" wrote in message
...
I'm trying to retrieve the autonumber field after an
insert and have tried the following different versions

Set objRecordset = objConnection.Execute("SELECT
@@IDENTITY")
Set rsNewID = objConnection.Execute("SELECT @@IDENTITY")
Set rsNewID = db.OpenRecordset("SELECT @@Identify")
Set rsNewID = db.OpenRecordset("GetBookingID")
Set rsNewID = commInsert.Execute("SELECT @@IDENTITY")

but get either Object Variable or with block variable not
set or Object Required.

What do I need to do? Thanks



  #3  
Old May 3rd, 2004, 11:04 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default @@'IDENTITY Object problem - Help!

And, I might add the reason why I spend time in these newsgroup to learn
things.

So, ignore my post about the fact that JET does not support identity....I
guess since jet 4.0...it does.....

Good post Van....and I think that using identity is quite neat..since you
then get compatible code between JET and server based code in case of
migration down the road....very nice...


--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.