ComboBox used for filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the code for filtering a form based on the contents of a combo box
in the form's header after it is updated or if another button is clicked. No
subform involved. This must be very basic-what am I missing?
 
gg,

If you add a combo control to the header section while the wizard button is
depressed, it will give you three options. Select the third option: "Find a
record on my form......". Once you're finished, open the property sheet for
your newly created combo, click the 'Events' tab, and click the button to
the far right on the AfterUpdate line. Your code will look like the
following:

Private Sub YourCombo_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![YourCombo])
Me.Bookmark = rs.Bookmark

End Sub

HTH,
Brian
 

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

Back
Top