No Records on Listbox - Controlled by Combo Box

  • Thread starter Thread starter Jen Preston via AccessMonster.com
  • Start date 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]
 
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
 
The listbox is not returning only the fields selected in my combo box.
It's returning all records.
 
Back
Top