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.

Combo Box - List Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dani Green - 03 May 2005 17:09 GMT
I have a combo box that when clicked will filter records based on the
companyid.

On this same form, I have a list box.  I need the list box to list only the
records based off the combo box AfterUpdate click, but my code is not
working. The combo is "Combo170" and the List is "List195". Here's 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 = [CompanyName]
             
           
   Me!Label90.Caption = sFilter
   Me!List195.RowSource = [Companyid]

   Me.List195.Requery

End Sub

Thanks for your help,
Dani
Michel Walsh - 11 May 2005 13:27 GMT
Hi,

   Try a complete SQL statement for your row source, something like:

  Me.List195.RowSource = "SELECT f1, f2, f3 FROM myTable WHERE CompanyID="
& Me.CompanyID

Hoping it may help,
Vanderghast, Access MVP

> I have a combo box that when clicked will filter records based on the
> companyid.
[quoted text clipped - 25 lines]
> Thanks for your help,
> Dani
 
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.