Question generate user identifier

eugz

Registered User.
Local time
Today, 15:00
Joined
Aug 31, 2004
Messages
128
Hi All.

If is possible generate user identifier? I mean user generator ID with any charters letter and number not table ID AutoNumber.

Thanks.
 
If you are on a network with unique logins you could grab that with something like ap_GetUserName()

Code:
Option Compare Database
Declare Function wu_GetUserName Lib "advapi32.dll" Alias _
   "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
   As Long
   
Function ap_GetUserName() As Variant
   
   Dim strUserName As String
   Dim lngLength As Long
   Dim lngResult As Long
   '-- Set up the buffer
   strUserName = String$(255, 0)
   lngLength = 255
   '-- Make the call
   lngResult = wu_GetUserName(strUserName, lngLength)
   
   '-- Assign the value
   ap_GetUserName = Left(strUserName, InStr(1, strUserName, Chr(0)) - 1)
   
End Function

However that doesn't help if you want something more random rather than just something unique to each user.
 
Hi CBrighton. Thanks for replay.

I need generate identifier for each new record.

Thanks.
 
Last edited:
So you want a record ID rather than a user ID.

You could do this my concatonating other fields together. The problem with making it 100% random is that you could get duplicates. With a well thought out combination of characters from other fields you know what you will get each time.
 
Yes, you are right. I tried concatenate Facility_code of facility table and AutoNumbet ID field of main table but got error. What is a problem?

Thanks
 
That depends, what was the error message?

What datatypes are the fields you are trying to use and the field you are trying to store this ID in?
 
Thanks for help.

I used plus sign like in SQL Server not &. Now is fixed.

Thanks
 

Users who are viewing this thread

Back
Top Bottom