Filtering a table using combos

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

Guest

hello to all

This is probably easy, but not for me! My form has a combobox (cbxAnimal)
with 2 columns (AnimalID and AnimalType). When I pick 'dog', for example, a
second combobox (cbxBreed) show only breeds of dogs (BreedID and BreedType).
So far so good.

When the user selects, say, Dog then Poodle, I want my form to show contact
info (LName, FName, Phone) only for Poodle owners. That's the part I'm
having trouble with. Could someone with access experience point me in the
right direction? Or, is there a code sample somewhere I could follow?

Pulling my hair out... Victoria
 
hello again

If I can clarify my question sent in earlier. So far I can use the
following code to delete the first record matching the combobox cbxAnimal:
My problem is that I don't understand the correct syntax to base the deletion
on the results of both cbxAnimal and cbxBreed. (these combos are indexed, so
the findfirst will always delete the correct one)

Private Sub cmdDelete_Click()
Dim rs As Object
Set rs = Me.Recordset.Clone

rs.findfirst "[AnimalID]= " & Me![cbxAnimal]
' I'd like the above line to say something like...
' "[AnimalID]= " & Me![cbxAnimal] AND "[BreedlID]= " &
Me![cbxBreed]
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

DoCmd.RunCommand acCmdDeleteRecord
End Sub

Thanks, Victoria
 
Back
Top