Filtering

  • Thread starter Thread starter Sport
  • Start date Start date
S

Sport

If I was to use an unbound text box as the an entry field for a form field
what would the code look like?

me.filter = true....
 
Try this in the After Update event procedure of your text box (named "txt1"
in this example):

Private Sub txt1_AfterUpdate()
If IsNull(Me.[txt1]) Then
Me.FilterOn = False
Else
Me.Filter = "[SomeField] = " & Me.txt1
Me.FilterOn = True
End If
End Sub

If SomeField is a Text type field (not Number), you need extra quotes:
Me.Filter = "[SomeField] = """ & Me.txt1 & """"
If it is a Date fiels use the # as delimiter:
Me.Filter = "[SomeField] = #" & Me.txt1 & "#"
 
Back
Top