L
LisaB
Can anyone tell me why this code is getting the runtime error. I am using
the same code in another database that uses the exact same tables
--------------------------------------------
Public Function IdentifyCurrentUser()
'Figure Out Who the Current user is and set the Global Staff ID
Set TheDB = CurrentDb
Set SourceRS = TheDB.OpenRecordset("tblStaff", dbOpenDynaset, dbSeeChanges)
******this line is highlighted during the debug
If SourceRS.RecordCount Then
SourceRS.MoveFirst
Do Until SourceRS.EOF
If SourceRS!UserName = CurrentUser Then
GLBL_StaffID = SourceRS!StaffID
End If
SourceRS.MoveNext
Loop
End If
SourceRS.Close
End Function
the same code in another database that uses the exact same tables
--------------------------------------------
Public Function IdentifyCurrentUser()
'Figure Out Who the Current user is and set the Global Staff ID
Set TheDB = CurrentDb
Set SourceRS = TheDB.OpenRecordset("tblStaff", dbOpenDynaset, dbSeeChanges)
******this line is highlighted during the debug
If SourceRS.RecordCount Then
SourceRS.MoveFirst
Do Until SourceRS.EOF
If SourceRS!UserName = CurrentUser Then
GLBL_StaffID = SourceRS!StaffID
End If
SourceRS.MoveNext
Loop
End If
SourceRS.Close
End Function