Here is the code I am using for (cboLASTNAME) the other 6 combo's are the same so if I can figure this one out I can fix the others.
Private Sub cboLASTNAME_AfterUpdate()
Call FormFilter
End Sub
Private Sub cboLASTNAME_DblClick(Cancel As Integer)
Me.cboLASTNAME = ""
Call FormFilter
End Sub
Function FormFilter()
Dim sql As String
Dim strCrit As String
Dim sqlLastname As String
Dim sqlLastname1 As String
Dim sqlFirstname As String
Dim sqlFirstname1 As String
sql = "SELECT qryEmployeeInfo.LastName, qryEmployeeInfo.FirstName, qryEmployeeInfo.DepartmentNumber, qryEmployeeInfo.BuildingNumber, qryEmployeeInfo.DepartmentName, qryEmployeeInfo.MailSlotID, qryEmployeeInfo.PlantIndicator,qryEmployeeInfo.Ter minated,qryEmployeeInfo.ID " & _
"FROM qryEmployeeInfo"
sqlLastname = "SELECT qryEmployeeFilter.LastName FROM qryEmployeeFilter"
sqlLastname1 = " GROUP BY qryEmployeeFilter.LastName ORDER BY qryEmployeeFilter.LastName;"
If IsNull(Me.cboLASTNAME) Or Me.cboLASTNAME = "" Then
strCrit = ""
Else
strCrit = " WHERE [LastName] Like '" & Me.cboLASTNAME & "'"
End If
If IsNull(strCrit) Or strCrit = "" Then
Me.RecordSource = sql
Me.cboLASTNAME.RowSource = sqlLastname & sqlLastname1
Else
Me.RecordSource = sql & strCrit
Me.cboLASTNAME.RowSource = sqlLastname & strCrit & sqlLastname1
End If
End Function
Me.Requery
Me.cboLASTNAME.Requery
me.cboLASTNAME.SetFocus
|