Change Label After Update of Combo Box

  • Thread starter Thread starter Greg Lyon via AccessMonster.com
  • Start date 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
 
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
 
Back
Top