M
MimiSD
I have a combo box on my form that i would like to use to filter my form. My
form is based upon a query that lists all the information pulled from 4
different tables. The combo box i have is an unbound combo in the header of
the form.
The code i am using is:
Private Sub cboSchlSearch_AfterUpdate()
Dim strWhere As String
If Me.Dirty Then
Me.Dirty = False
End If
With Me.cboSchlSearch
If IsNull(.Value) Then
If Me.FilterOn Then
Me.FilterOn = False
End If
Else
strWhere = "[SchoolName]= '" & .Value & "'"
Me.Filter = strWhere
Me.FilterOn = True
End If
End With
End Sub
I have used very similar code on a few other forms where it works fine but
for some reason on this one it doesn't. What happens when you make your
selection of what School Name you want then the form goes blank and nothing
displays. I think one thing that may be affecting it would be that the
School Name is not the primary key. but i have the key in the combo box just
not displayed. Is that what is wrong? if so how do i fix it? If not, what
else could be wrong?
form is based upon a query that lists all the information pulled from 4
different tables. The combo box i have is an unbound combo in the header of
the form.
The code i am using is:
Private Sub cboSchlSearch_AfterUpdate()
Dim strWhere As String
If Me.Dirty Then
Me.Dirty = False
End If
With Me.cboSchlSearch
If IsNull(.Value) Then
If Me.FilterOn Then
Me.FilterOn = False
End If
Else
strWhere = "[SchoolName]= '" & .Value & "'"
Me.Filter = strWhere
Me.FilterOn = True
End If
End With
End Sub
I have used very similar code on a few other forms where it works fine but
for some reason on this one it doesn't. What happens when you make your
selection of what School Name you want then the form goes blank and nothing
displays. I think one thing that may be affecting it would be that the
School Name is not the primary key. but i have the key in the combo box just
not displayed. Is that what is wrong? if so how do i fix it? If not, what
else could be wrong?