You can use @@identity in Access, when you use the same connection:

Insert into table (field1, field2) values (value1,value2)

Select @@identity as identity ' To grab it for use in your programming

Insert into table2 (field1, field2) values (@@identity, value2) ' To
automatically insert it



Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com
 

-----Original Message-----
From: Steve Abaffy [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 12, 2002 11:50 AM
To: ActiveServerPages
Subject: RE: Getting the AutoNumber ID

If your using SQL you could write a Stored Procedure where the last line
in
the procdure is

Select @@identity as WhatEverYouWantToCallIt

And then in your ASP code

SET RS = Conn.Execute("Exec SP_YourNewStoredProcdure
@Value1='Value1',@Value2='Value2'")
Then RS("WhatEverYouWantToCallIt) will equal your Autonumber value.


-----Original Message-----
From: Andy Hayman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 10:57 AM
To: ActiveServerPages
Subject: Getting the AutoNumber ID


Ok I am writing using UPDATE to a record, but I need the unique
autonumber
"ID" field the database has just created how do I get that? The only way
I
can think of is to goto the last record, is there another waY?


---
Andy Hayman
Kensington Computers
Internet & Computers Systems Consultant
Web             <http://www.ken.co.uk>
Email           <mailto:[EMAIL PROTECTED]>
Telephone       020 7835 1282
Fax:            020 7373 6900

Disclaimer
This e-mail is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not represent those of Kensington
Computers. If you are not the intended recipient, be advised that you
have
received this mail in error and that any use, dissemination, forwarding,
printing or copying of this e-mail is strictly prohibited.

---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%




---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%




---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to