Determine AUTONUMBER after an INSERT?

  • Thread starter Thread starter Joseph Meehan
  • Start date Start date
J

Joseph Meehan

Noozer said:
ASP webpage is inserting a new record into a table. One of the
columns in an autonumber. How can I get the autonumber after
inserting a row?

Note we always have to say this if you want to see or need to know the
autonumber:

I suggest you may not want to use Autonumber for that use. Autonumbers are
designed to provide unique numbers. It in not designed to provide numbers
in order and for a number of reasons may not do so. As a result using them
in any application where the user sees the numbers is likely to end up with
confusion.

There are other ways of providing the numbers you want depending on the
particual application.
 
ASP webpage is inserting a new record into a table. One of the columns in an
autonumber. How can I get the autonumber after inserting a row?

The table Calls has the field "IP" which is a 16 character text field,
"Submitted" is a date/time field, and "CallID" which is an autonumber field.

'Add row to database
strSQL="INSERT INTO Calls (IP, Submitted) VALUES ('" & AgentIP & "', #" &
When & "#);"
adoCon.Execute strsql
'**** How to get CALLID from newly added row? ****
rsSet.close
 
Joseph Meehan said:
Note we always have to say this if you want to see or need to know the
autonumber:

I suggest you may not want to use Autonumber for that use. Autonumbers are
designed to provide unique numbers. It in not designed to provide numbers
in order and for a number of reasons may not do so. As a result using them
in any application where the user sees the numbers is likely to end up with
confusion.

There are other ways of providing the numbers you want depending on the
particual application.

Only using the number to link to other tables. Definately not counting on it
being sequential in any way, otherwise I could just use the MAX function to
find it.
 
Noozer said:
ASP webpage is inserting a new record into a table. One of the columns in an
autonumber. How can I get the autonumber after inserting a row?

The table Calls has the field "IP" which is a 16 character text field,
"Submitted" is a date/time field, and "CallID" which is an autonumber field.

'Add row to database
strSQL="INSERT INTO Calls (IP, Submitted) VALUES ('" & AgentIP & "', #" &
When & "#);"
adoCon.Execute strsql
'**** How to get CALLID from newly added row? ****
rsSet.close

This can't be impossible... It would almost be assinine!

the adoCon.Execute command should return a recordset of all the affected
rows. Not sure if it really does or not.

: (
 
Back
Top