Change Label After Update of Combo Box

  • Thread starter Greg Lyon via AccessMonster.com
  • Start date
G

Greg Lyon via AccessMonster.com

I have the following code to change the label to the company name after
clicking on the company name drop down. The records are populating, but
will NOT update the label. How do I get the company name to populate the
label based upon the company id?

What's wrong with my code???

Private Sub Combo170_AfterUpdate()
' Find the record that matches the control.
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 = [Companyid]

Me.Filter = sFilter
Me.FilterOn = Len(sFilter) > 0

Me!HeaderNm.Caption = sFilter

End Sub
 
G

Greg Lyon via AccessMonster.com

I figured it out. I changed my code. It's working fine now...

Private Sub Combo170_AfterUpdate()
' Find the record that matches the control.
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 = [Companyid]
Me!HeaderNm.Caption = sFilter

End Sub
 

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