Filtering

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....
 
A

Allen Browne

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 & "#"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top