V
Victoria
Hello,
I am trying to create an order number using UserID + counter due to
the fact tha my database will be distributed to about 20 end user to
be used to place orders at the convention. I so allot on the toping
and copied allot of code back an forth with no luck untill I stumbled
upone environ("username") function. I placed in to the default field
in my UderID text box on my form and it works fine. However, I just
emailed a copy to my collegue and when he open the database, the
username was not shoing up as part of the order number.
Please help.
I have found the following code for FOSUserName function which
everyone seems to say is more relaiable than environ(usernma).
However, I placed it in a module as per instructions and called the
module for FOSUserName. When I run the I get a compile error before
for (by Val IpBuffer....)
Option Compare Database
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "Advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Can some one please help me get the userid from the network? I would
need specific instructions for the code and where to call it from. My
filed in my form is called UserID, and it is in Orders form. I have to
distribute the database in few days.
Thank you,
Victoria
I am trying to create an order number using UserID + counter due to
the fact tha my database will be distributed to about 20 end user to
be used to place orders at the convention. I so allot on the toping
and copied allot of code back an forth with no luck untill I stumbled
upone environ("username") function. I placed in to the default field
in my UderID text box on my form and it works fine. However, I just
emailed a copy to my collegue and when he open the database, the
username was not shoing up as part of the order number.
Please help.
I have found the following code for FOSUserName function which
everyone seems to say is more relaiable than environ(usernma).
However, I placed it in a module as per instructions and called the
module for FOSUserName. When I run the I get a compile error before
for (by Val IpBuffer....)
Option Compare Database
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "Advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Can some one please help me get the userid from the network? I would
need specific instructions for the code and where to call it from. My
filed in my form is called UserID, and it is in Orders form. I have to
distribute the database in few days.
Thank you,
Victoria