I work with MS Access quite a bit and you can't quite do what you want in
Access either.  What I do there is create a unique combination of something
like the following:

TIMESTAMP as datefield
USERNAME as text(50)    

SAVETIME = NOW()

I write the record and then, do a select on the record where TIMESTAMP =
SAVETIME AND USERNAME = CURRENT USER NAME

I suppose you could even use a session number as well if you could get it.

I have been programming pretty intensely with MS Access for a number of
years now and this is the only way I found to do what you want.  I'm not
quite sure how to do it in Perl since I am a newbie at it, but I'm sure you
could use the same approach.

I'm very interested in how you get Perl to work with MS Access databases.  I
can get it to work using the command line, but I can't get it to work using
CGI.

I hope that this was helpful.

Thanks,
Pete MacGown
AT&T Broadband

-----Original Message-----
From: Troy Sniff [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 4:09 PM
To: [EMAIL PROTECTED]
Subject: Returning auto incremented value on insert


I am performing an insert into an access table where the primary key is
set to auto increment.

When I insert a record, is there an easy way to grab the value created
by the auto increment without having to go back in read the newly
created record?

I need the value to display a result such as:

"Your information has been added.  The record number assigned was 1000.
We recommend you write this down for future reference".

Troy


Reply via email to