Here is what I have for each combobox:
How would I do it so I can filter using any combination of the three or two or just the one using a command button?
I found this on the net and modified for my needs but i get an error:
The Error is Variable not defined
It highlights vbNullstr
The site I got it from did not have it called out so I have no clue what it's for or if I even need it.
Thanks for any and all advise
Code:
Private Sub CmbLineSearch_AfterUpdate() DoCmd.ApplyFilter , "[LineNoID] = " & Str(Nz([Screen].[ActiveControl], 0)) End Sub
Code:
Private Sub cmbSearchDate_AfterUpdate() DoCmd.ApplyFilter , "[LineDate] = " & "#" & Format([Screen].[ActiveControl], "mm/dd/yyyy") & "#" End Sub
Code:
Private Sub cmbShiftSearch_AfterUpdate() DoCmd.ApplyFilter , "[Shift] = " & Str(Nz([Screen].[ActiveControl], 0)) End Sub
I found this on the net and modified for my needs but i get an error:
Code:
Private Sub ApplyFilter_Click() Dim strFilter As String strFilter = "" ' see if there is data in combo box CmbLineSearch, if so add it to the filter If Me!cmbSearchDate & vbNullStr <> vbNullStr Then strFilter = strFilter & " AND [LineDate] = " & Me.cmbSearchDate End If If Me!CmbLineSearch & vbNullStr <> vbNullStr Then strFilter = strFilter & " AND [LineNoID] = #" & Me.CmbLineSearch & "#" End If If Me!cmbShiftSearch & vbNullStr <> vbNullStr Then strFilter = strFilter & " AND [Shift] = #" & Me.cmbShiftSearch & "#" End If If strFilter <> "" Then ' trim off leading "AND" Me.Filter = Mid(strFilter, 4) Me.FilterOn = True Else Me.Filter = "" Me.FilterOn = False End If End Sub
It highlights vbNullstr
The site I got it from did not have it called out so I have no clue what it's for or if I even need it.
Thanks for any and all advise
Comment