No Records on Listbox - Controlled by Combo Box

  • Thread starter Jen Preston via AccessMonster.com
  • Start date
J

Jen Preston via AccessMonster.com

I need my list box to populate with records belonging to my combo drop
down. The drop down is based on companyid. My code is not working. The
list box is always blank. Here's my code:

Private Sub Combo170_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Companyid] = " & Str(Nz(Me![Combo170], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Dim sFilter As String
sFilter = [CompanyName]

Me!Label90.Caption = sFilter
Me!List195.RowSource = [Companyid]

End Sub


In my query of the "list195" I have the following on companyid:
[Forms]![frmEdit]![Combo170]
 
R

Rob Parker

If your existing query for the list-box's rowsource is returning the records
you want, filtered by the value of your combo-box (run the query
separately - with the form open and a selection in the combo-box - to
confirm this), then all you need is:

Me!List195.Requery

HTH,

Rob
 
D

Danielle Haile via AccessMonster.com

The listbox is not returning only the fields selected in my combo box.
It's returning all records.
 

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