AVONFRS
asked on
Microsoft Access Macro over Citrix Error
Our HR Database is currently experiencing issues whilst running over Citrix.
This is the application location command line in the Citrix Program Neighbourhood:
"M:\Program Files\Microsoft Office\Office\MSACCESS.EXE " "h:\hr_db_view\rostfm_2008 i.mdb"
When running it should ask you to log in (users details are stored in the access database).
However, we get an error message (see attached image).
Can anybody suggest anything about this issue?
Thanks
login.JPG
This is the application location command line in the Citrix Program Neighbourhood:
"M:\Program Files\Microsoft Office\Office\MSACCESS.EXE
When running it should ask you to log in (users details are stored in the access database).
However, we get an error message (see attached image).
Can anybody suggest anything about this issue?
Thanks
login.JPG
ASKER
This is the code that is in the login part. I am not a Visual Basic editor at all, so any help would be fantastic.
Option Compare Database
Function DoLogin() As Integer
Dim db As Database
Dim tmpformtocall As String
Dim sqlstr As String
Dim tmpid As Long
' dim t as table
DoCmd.OpenForm "Login", A_NORMAL, "", "", A_EDIT, A_DIALOG
If (Not (FIsLoaded("Login"))) Then
DoError ideLOGINABORTED
DoCmd.SelectObject A_FORM, "Login", True
If FToolbarWasUp() Then
x% = ShowToolbar()
End If
DoCmd.Close
End If
If (FValidUser(Forms!LOGIN!Us erID, Forms!LOGIN!Password)) Then
If (FIsLoaded("Login")) Then
tmpid = DLookup("ID", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
tmpformtocall = DLookup("Formtocall", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
GBLACCESS = DLookup("ACCESS_Rights", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
' write to log
sqlstr = "Insert into [user_log](user_name,log_d ate,action ) values ("
sqlstr = sqlstr & "'" & Forms!LOGIN!UserID & "','" & Now() & "','LOG IN');"
DoCmd.SetWarnings False
DoCmd.RunSQL sqlstr
sqlstr = "Update [user] set [usercount]=[usercount]-1 where [id]=" & tmpid
DoCmd.RunSQL sqlstr
DoCmd.SetWarnings True
'
GBLUSER = Forms!LOGIN!UserID
GBLUSERID = tmpid
DoCmd.Close A_FORM, "Login"
stLinkCriteria = ""
DoCmd.OpenForm tmpformtocall, , , stLinkCriteria
End If
Else
If (FIsLoaded("Login")) Then
DoCmd.Close A_FORM, "Login"
End If
f% = DoLogin()
End If
End Function
Function FValidUser(idUser As Variant, pwd As Variant) As Integer
Dim db As Database
Dim t As Recordset
On Error GoTo FValidUserError
fUserExists% = False
stUserID$ = ConvertNulls(idUser, "")
stPassword$ = ConvertNulls(pwd, "")
Set db = CurrentDb()
Set t = db.OpenRecordset("User")
If (t.RecordCount > 0) Then
t.MoveFirst
While (Not (t.EOF))
If (t!Name = stUserID$) Then
fUserExists% = True
If (stPassword$ = t!Password) Then
If t!UserCount > 0 Then
FValidUser = True
GoTo FValidUserExit
End If
End If
End If
t.MoveNext
Wend
End If
If (fUserExists%) Then
DoError ideINVALIDPWD
Else
DoError ideINVALIDUSERID
End If
FValidUser = False
FValidUserExit:
t.Close
db.Close
Exit Function
FValidUserError:
FValidUser = False
MsgBox Error$, 0, "Error Validating User"
Resume FValidUserExit
End Function
Option Compare Database
Function DoLogin() As Integer
Dim db As Database
Dim tmpformtocall As String
Dim sqlstr As String
Dim tmpid As Long
' dim t as table
DoCmd.OpenForm "Login", A_NORMAL, "", "", A_EDIT, A_DIALOG
If (Not (FIsLoaded("Login"))) Then
DoError ideLOGINABORTED
DoCmd.SelectObject A_FORM, "Login", True
If FToolbarWasUp() Then
x% = ShowToolbar()
End If
DoCmd.Close
End If
If (FValidUser(Forms!LOGIN!Us
If (FIsLoaded("Login")) Then
tmpid = DLookup("ID", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
tmpformtocall = DLookup("Formtocall", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
GBLACCESS = DLookup("ACCESS_Rights", "User", "[Name]=""" + Forms!LOGIN!UserID + """")
' write to log
sqlstr = "Insert into [user_log](user_name,log_d
sqlstr = sqlstr & "'" & Forms!LOGIN!UserID & "','" & Now() & "','LOG IN');"
DoCmd.SetWarnings False
DoCmd.RunSQL sqlstr
sqlstr = "Update [user] set [usercount]=[usercount]-1 where [id]=" & tmpid
DoCmd.RunSQL sqlstr
DoCmd.SetWarnings True
'
GBLUSER = Forms!LOGIN!UserID
GBLUSERID = tmpid
DoCmd.Close A_FORM, "Login"
stLinkCriteria = ""
DoCmd.OpenForm tmpformtocall, , , stLinkCriteria
End If
Else
If (FIsLoaded("Login")) Then
DoCmd.Close A_FORM, "Login"
End If
f% = DoLogin()
End If
End Function
Function FValidUser(idUser As Variant, pwd As Variant) As Integer
Dim db As Database
Dim t As Recordset
On Error GoTo FValidUserError
fUserExists% = False
stUserID$ = ConvertNulls(idUser, "")
stPassword$ = ConvertNulls(pwd, "")
Set db = CurrentDb()
Set t = db.OpenRecordset("User")
If (t.RecordCount > 0) Then
t.MoveFirst
While (Not (t.EOF))
If (t!Name = stUserID$) Then
fUserExists% = True
If (stPassword$ = t!Password) Then
If t!UserCount > 0 Then
FValidUser = True
GoTo FValidUserExit
End If
End If
End If
t.MoveNext
Wend
End If
If (fUserExists%) Then
DoError ideINVALIDPWD
Else
DoError ideINVALIDUSERID
End If
FValidUser = False
FValidUserExit:
t.Close
db.Close
Exit Function
FValidUserError:
FValidUser = False
MsgBox Error$, 0, "Error Validating User"
Resume FValidUserExit
End Function
Are you opening this in a Terminal Server session, where you've gotten this error? If so, you might try walking the code to see what's happening. To do that:
In the VB Editor, place your cursor in the first line of code (the one reading Function DoLogin() As Integer). Press the F9 key - this should highlight that line in Red. Now run the code ... simplest way to do that is to use the Immediate window (press Ctrl + G) and type in ?DoLogin then press Enter. This should take you to the Function line you were at earlier. To "step" through the code, press the F8 key to move down line-by-line until you receive an error ... report back what this error was, and which line it occurred on.
In the VB Editor, place your cursor in the first line of code (the one reading Function DoLogin() As Integer). Press the F9 key - this should highlight that line in Red. Now run the code ... simplest way to do that is to use the Immediate window (press Ctrl + G) and type in ?DoLogin then press Enter. This should take you to the Function line you were at earlier. To "step" through the code, press the F8 key to move down line-by-line until you receive an error ... report back what this error was, and which line it occurred on.
ASKER
Thanks for the reply.
After i pressed enter, i got the following error , and couldnt progress any further.
compile.JPG
After i pressed enter, i got the following error , and couldnt progress any further.
compile.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for your help. This problem has been happening for 2 months. Thanks so much
You can try the standard things:
Compact and Repair
Verify there are no stray .ldb files in the application directory (if there are, delete them)
Rebuild the file
Do you know what the DoLogin() macro does? Can you provide the code/calls that it makes?