then the problem is obviously in the code or elsewhere. the issue is the box OR the code. the problem with the box would be if you've got an sql with multiple fields selected. do you?? if so, use the right column in your code!
if you only have one field going on in the sql, then try one of these different blocks below:
Code:
Private Sub Command65_Click()
If IsNull(Me.CompanyFilter) Then
Forms!Agent!.FilterOn = False
Else
forms!agent!.filteron =false
Forms!Agent!.Filter = "Company = '" & Me.CompanyFilter & "'"
Forms!Agent!.FilterOn = True
End If
End Sub
Code:
Private Sub Command65_Click()
If IsNull(Me.CompanyFilter) Then
Forms!Agent!.FilterOn = False
Else
Forms!Agent!.Filter = "[Company] = '" & Me.CompanyFilter & "'"
Forms!Agent!.FilterOn = True
End If
End Sub
if this is the same form, use ME.:
Code:
Private Sub Command65_Click()
If IsNull(Me.CompanyFilter) Then
me.FilterOn = False
Else
me.Filter = "Company = '" & Me.CompanyFilter & "'"
me.FilterOn = True
End If
End Sub
NEVER mix "!" symbols with "." symbols, especially when they're sequential characters in code. 2 reasons - 1) it's unnecessary, because the combination is interchangable for either a "." or "!" in all scenarios, and 2) it confuses the heck out of you later on.