I'm attempting to filter a subform based on a user ID, but no filter is taking place. I get no errors (run-time or compiler), but nothing happens. I don't work with filters much so I would assume that I'm doing something wrong, but I can't find it.
Here is the query that is the recordsource for the subform:
The Processor and LoanOfficer fields are what I'm trying to filter. However, the form doesnt' contain these fields. I didn't think that it needed to, but I could be wrong.
Here is my code to filter the form:
I know my TempVars are working properly, because the buttons are correctly being visible or invisiable. My problem is that when I have a loan processor log on (case 2), I can still see all the records. I haven't tried a loan officer yet, but I would assume that since the code is the same, I will get the same result.
Here is the query that is the recordsource for the subform:
Code:
SELECT tblLoans.LoanID , tblLoans.LoanNumber , tblLoans.Borrower , tblAppraisals.DateOrdered , tblAppraisals.DateReceived , tblLoans.Processor , tblLoans.LoanOfficer FROM tblAppraisals INNER JOIN tblLoans ON tblAppraisals.LoanID = tblLoans.LoanID WHERE (((IsNull([CompletedDate]))<>False));
Here is my code to filter the form:
Code:
Private Sub Form_Load() On Error GoTo Form_Error Dim strFilter As String Call GetUserID If IsNull(Application.TempVars("UserID").Value) Then Call LockSystem Exit Sub End If Select Case Application.TempVars("UserType").Value Case 1 'Loan Operations 'No filter Me.cmdAdministrativeForms.Visible = True Me.cmdAddressSearch.Visible = True strFilter = "" Case 2 'Loan Processor Me.cmdAdministrativeForms.Visible = False Me.cmdAddressSearch.Visible = False strFilter = "Processor = " & Application.TempVars("UserID").Value Case 3 'Loan Officer Me.cmdAdministrativeForms.Visible = False Me.cmdAddressSearch.Visible = False strFilter = "LoanOfficer = " & Application.TempVars("UserID").Value Case 4 'Administrator 'No filter Me.cmdAdministrativeForms.Visible = True Me.cmdAddressSearch.Visible = True strFilter = "" End Select Me.sfrmAppraisalsSummary.Form.FilterOn = True Me.sfrmAppraisalsSummary.Form.Filter = strFilter Me.sfrmCentralizedProcessingSummary.Form.FilterOn = True Me.sfrmCentralizedProcessingSummary.Form.Filter = strFilter Me.sfrmMortgageLogSummary.Form.FilterOn = True Me.sfrmMortgageLogSummary.Form.Filter = strFilter 'MsgBox "User ID: " & Application.TempVars("UserID").Value & vbCrLf & _ "User Type: " & Application.TempVars("UserType").Value Form_Exit: Exit Sub Form_Error: MsgBox "Error Description: " & Err.Description & vbCrLf & _ "Number: " & Err.Number & vbCrLf Resume Form_Exit End Sub
Comment