[AccessD] Return Autonumber Value

JWColby jwcolby at colbyconsulting.com
Fri Jan 12 08:01:17 CST 2007


You didn't say how you write this into the table.  If you use a SQL
statement or query then that is about the best you can do I think,
although... If you know the name of the user you could do a Top 1 where user
=  "SomeUserName".  Or you could use a function that opens a recordset and
writes the record.  Doing that you could grab the autonumber right in that
routine.


John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
paul.hartland at fsmail.net
Sent: Friday, January 12, 2007 5:55 AM
To: accessd
Subject: [AccessD] Return Autonumber Value
Importance: High

To all,

I have a user log table (tblUserLog) for which I want to store user logon
details (Name, LogonDate, LogonTime, LogoffTime, TotalTime), I also have an
autonumber field called LogID.  What I need is when I write the initial user
log details, I want to return the LogID into a variable.  What I did think
of is write the record details and then do a MAX on the LogID field, but
what would happen if two users logged on at the same time would it be
possible to return the wrong LogID for one of the users ?

What is the best way to go about this ?

Thanks in advance for any help.

Paul Hartland
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list