Hey,
So i looked up some other threads on getting filters on reports pre-emptively before you actually open the report. What I am trying to do is take my ULS which contains the last name and the access level and look up the user ID number (which is displayed in the employeeinformation table) and create a filter for the current user.
The error im gettins is that "The expression you entered as a query parameter produced this error: 'Shmoe'" (which is the users last name)
This is my code if anyone can help make sense of this error with me
Case 1
strUN = Forms!formUserLoginAccess!txtUN
intID = DLookup("[Emp_ID]", "tblEmployeeInformation", "[Emp_Lname]=" & strUN)
intUSL = Forms!formUserLoginAccess!txtUSL
strReport = InputBox("Please Enter the Name of the report you wish to view i.e. DailyReport, WeeklyReport, ForecastReport")
If intUSL = 1 Then
DoCmd.OpenReport strReport, acViewNormal
End If
If intUSL = 2 Then
DoCmd.OpenReport strReport, acViewNormal, , "[Emp_ID]=" & intID
End If
If intUSL = 3 Then
DoCmd.OpenReport strReport, acViewNormal, , "[Emp_ID]=" & intID
End If
If intUSL = 4 Then If MsgBox("You do not have sufficient access to this database!", vbOKOnly, "Restricted Access") = vbOK Then DoCmd.Quit
So i looked up some other threads on getting filters on reports pre-emptively before you actually open the report. What I am trying to do is take my ULS which contains the last name and the access level and look up the user ID number (which is displayed in the employeeinformation table) and create a filter for the current user.
The error im gettins is that "The expression you entered as a query parameter produced this error: 'Shmoe'" (which is the users last name)
This is my code if anyone can help make sense of this error with me
Case 1
strUN = Forms!formUserLoginAccess!txtUN
intID = DLookup("[Emp_ID]", "tblEmployeeInformation", "[Emp_Lname]=" & strUN)
intUSL = Forms!formUserLoginAccess!txtUSL
strReport = InputBox("Please Enter the Name of the report you wish to view i.e. DailyReport, WeeklyReport, ForecastReport")
If intUSL = 1 Then
DoCmd.OpenReport strReport, acViewNormal
End If
If intUSL = 2 Then
DoCmd.OpenReport strReport, acViewNormal, , "[Emp_ID]=" & intID
End If
If intUSL = 3 Then
DoCmd.OpenReport strReport, acViewNormal, , "[Emp_ID]=" & intID
End If
If intUSL = 4 Then If MsgBox("You do not have sufficient access to this database!", vbOKOnly, "Restricted Access") = vbOK Then DoCmd.Quit