Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2005

Tip: Looking for answers? Try searching our database.

Change Label After Update of Combo Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Lyon - 02 May 2005 21:16 GMT
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
Greg Lyon - 02 May 2005 21:27 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.