Selecting records on a form

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

Guest

I have continuous form that I would like to only show certain records. I have
a combo box set up to select records that meet the criteria in the combo box
but I only want it to show those records. How can I set this up to only show
those? Right now when I select something from the combo box it just goes to
the first record that meets that criteria. I want it to only show those
records and nothing else. How would I do this? Also, when I open the form I
don't want any records to be shown until I make a selection from the combo
box.
 
I have continuous form that I would like to only show certain records. I have
a combo box set up to select records that meet the criteria in the combo box
but I only want it to show those records. How can I set this up to only show
those? Right now when I select something from the combo box it just goes to
the first record that meets that criteria. I want it to only show those
records and nothing else. How would I do this? Also, when I open the form I
don't want any records to be shown until I make a selection from the combo
box.

Set the form's Filter property in the combo box's AfterUpdate event
(and turn the filtering on):

Private Sub cboCriteria_AfterUpdate()
Me.Filter = "[Fieldname] = " & Me!cboCriteria
Me.FilterOn = True
End Sub

If the field is of Text type, you need some quotemarks:

Me.Filter = "[Fieldname] = '" & Me!cboCriteria & "'"

John W. Vinson[MVP]
 

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

Similar Threads


Back
Top