G
Guest
I have the following code when my app first opens. The point to the code is
to see who is logged into to windows and depending on who is logged in, it
will open 1 of 2 forms. I have tested it with myself logged in "jculver" and
for some reason it skips opening the "ARCManagement" form and opens the
other. I can't figure out why it isn't working. Any help?
Here is the code
Option Compare Database
Public Declare Function getUserName Lib _
"advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Public Const MAX_BUFFER_LENGTH = 100
Public TempEvent As String
Public Function getLoggedUserName() As String
Dim strBufferString As String
Dim lngResult As Long
strBufferString = String(MAX_BUFFER_LENGTH, "X")
lngResult = getUserName(strBufferString, MAX_BUFFER_LENGTH)
getLoggedUserName = Mid(strBufferString, 1, MAX_BUFFER_LENGTH)
If getLoggedUserName = "jculver" Then
DoCmd.OpenForm ("ARCManagement")
Else
DoCmd.OpenForm ("VOARCManagement")
End If
End Function
to see who is logged into to windows and depending on who is logged in, it
will open 1 of 2 forms. I have tested it with myself logged in "jculver" and
for some reason it skips opening the "ARCManagement" form and opens the
other. I can't figure out why it isn't working. Any help?
Here is the code
Option Compare Database
Public Declare Function getUserName Lib _
"advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Public Const MAX_BUFFER_LENGTH = 100
Public TempEvent As String
Public Function getLoggedUserName() As String
Dim strBufferString As String
Dim lngResult As Long
strBufferString = String(MAX_BUFFER_LENGTH, "X")
lngResult = getUserName(strBufferString, MAX_BUFFER_LENGTH)
getLoggedUserName = Mid(strBufferString, 1, MAX_BUFFER_LENGTH)
If getLoggedUserName = "jculver" Then
DoCmd.OpenForm ("ARCManagement")
Else
DoCmd.OpenForm ("VOARCManagement")
End If
End Function