Im sure this is something simple but i cant seem to get it working and my deadline is fast approaching.
I have a simple form that contains some combo boxes used for filtering data and a listbox to display the results of the query. The query SQL is executed with the forms OnCurrent event, which from what i read should run every time the form is re-queried. I have added a Me.requery line to the OnChange event for my combo boxes used for filters but it does nothing. I have verified that all the code in the OnCurrent Event is working just fine, but why is it not running with a re-query? FYI: controls are contained on the form itself, no subforms
I have a simple form that contains some combo boxes used for filtering data and a listbox to display the results of the query. The query SQL is executed with the forms OnCurrent event, which from what i read should run every time the form is re-queried. I have added a Me.requery line to the OnChange event for my combo boxes used for filters but it does nothing. I have verified that all the code in the OnCurrent Event is working just fine, but why is it not running with a re-query? FYI: controls are contained on the form itself, no subforms
Code:
Private Sub btnClearFilters_Click()
Me.cboFilterAsignee = Null
Me.cboFilterOriginator = Null
Me.Requery
End Sub
Private Sub cboFilterAsignee_Change()
Forms("Communicators").Refresh
End Sub
Private Sub cboFilterOriginator_Change()
Me.Requery
End Sub
Private Sub Form_Current()
Dim strSQL, strWhereSQL, strEmpID As String
On Error GoTo ErrorHandler:
If Len(Nz(Me.cboFilterAsignee, "")) <> 0 Then
strWhereSQL = strWhereSQL & "AND ((Communicator.Send_To) = '" & Me.cboFilterAsignee & "')"
End If
If Len(Nz(Me.cboFilterOriginator, "")) <> 0 Then
strEmpID = DLookup("EmpID", "dbo_ICEp_vwEmpBasic", "dbo_ICEp_vwEmpBasic.EmpName = '" & Me.cboFilterOriginator & "'")
strWhereSQL = strWhereSQL & "AND ((dbo_ICEp_vwEmpBasic.EmpName) = '" & Me.cboFilterOriginator & "')"
End If
strSQL = "SELECT Communicator.CommunicatorID, dbo_ICEp_vwEmpBasic.EmpName AS Originator, Communicator.Date_Today AS Submitted, Communicator.Equip_ID_Num AS [Equipment ID], " & _
"Communicator.Problem, Communicator.[Completion Date] FROM dbo_ICEp_vwEmpBasic INNER JOIN Communicator ON dbo_ICEp_vwEmpBasic.EmpID = Communicator.EE_NUM " & _
"WHERE ((Communicator.[Completion Date]) Is Null) " & strWhereSQL & " ORDER BY Communicator.Date_Today DESC;"
Me.lstOpenCommunicators.RowSource = strSQL
Debug.Print strSQL
Me.Requery
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description & vbNewLine & "If the error persists, close and re-open the Info Center.", , "Info Center Database Error"
Exit Sub
End Sub