I have a form upon opening a MSAccess 2016 db.
It grabs the UserID.
Option Compare Database
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 = ""
End If
End Function
On enter of this form it opens to another form containing links to other forms.
On these other forms, they contain an unbound text box grabbing =fosusername() to populate user id on the form.
This works for 6 out of the 7 forms.
I can't get the 1 form to populate. Have done nothing different in this one.
Even delete the button to get to that form and recreated, but, still get compile error. Sub or Function not defined.
What am I missing?
Jennifer:banghead:
It grabs the UserID.
Option Compare Database
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 = ""
End If
End Function
On enter of this form it opens to another form containing links to other forms.
On these other forms, they contain an unbound text box grabbing =fosusername() to populate user id on the form.
This works for 6 out of the 7 forms.
I can't get the 1 form to populate. Have done nothing different in this one.
Even delete the button to get to that form and recreated, but, still get compile error. Sub or Function not defined.
What am I missing?
Jennifer:banghead: