Filter Question

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a List Box from a query on my form that has a field ClientID and 2
other fields and on my form I have one ClientID, How can I filter the list
box to only show the two other fields with the same ClientID in the list
Box, Thanks for any Help
 
Start off with the listbox having no Recordsource. Then once the clientID is
chosen, in the AfterUpdate event set Recordsource = "Select * from MyTable
where clientid=[value of clientid]. Then choose listbox.requery. It would
look something like

Sub MyField_AfterUpdate()
Dim lngCltID As Long

lngCltID = Me.txtClientID
Me.lstBox.RowSource = "Select * from MyTable Where ClientID=" & lngCltID
Me.lstBox.Requery
End sub

Note that if the clientids are not chosen on the form, you will want to use
the Form_Current() event to run this code.

Pleaset let me know if I can provide more assistance.
 

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

Please help 31
Filter using two criteria 2
Combo box to show selective Records! 4
linked tables query 9
Outer Joins??? 1
Link a combo-box to another table 1
Iff statements 1
DoCmd.RunSQL "INSERT INTO (append) 4

Back
Top