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 / July 2007

Tip: Looking for answers? Try searching our database.

dependent combo box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jenny - 05 Jul 2007 22:40 GMT
I have 2 combo boxes on a form, cbostate and cbocounty.  I want the cbocounty
combo to list only counties in the state chosen in the first combo box.  Here
is what I have, but the cbocounty combo box doesn't update and display any
counties.
I have a table of unique State and county combinations called tblCounty-ST.
The row source for cbostate is...
SELECT DISTINCT [tblCounty-ST].ST FROM [tblCounty-ST] ORDER BY
[tblCounty-ST].ST;
The after update event code is...
rivate Sub cbostate_AfterUpdate()
On Error Resume Next
  cbocounty.RowSource = "Select tblCounty-ST.Cty " & _
           "FROM tblCounty-ST " & _
           "WHERE tblCounty-ST.ST = '" & cbostate.Value & "' " & _
           "ORDER BY tblCountry-ST.Cty;"
End Sub
my row source for cbocounty is blank.

thanks in advance
jahoobob - 06 Jul 2007 01:30 GMT
Try this site:
http://www.pacificdb.com.au/MVP/Code/ComboRS.htm

>I have 2 combo boxes on a form, cbostate and cbocounty.  I want the cbocounty
>combo to list only counties in the state chosen in the first combo box.  Here
[quoted text clipped - 15 lines]
>
>thanks in advance
Jenny - 09 Jul 2007 17:02 GMT
I tried using the code from the website, but I'm still not getting any data
in my 2nd combo box after selecting from my first combo box.  Not sure what
I'm doing wrong.

> Try this site:
> http://www.pacificdb.com.au/MVP/Code/ComboRS.htm
[quoted text clipped - 18 lines]
> >
> >thanks in advance
Douglas J. Steele - 09 Jul 2007 19:26 GMT
Unfortunately, none of us can offer any suggestions without knowing what
you've tried so far.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I tried using the code from the website, but I'm still not getting any data
> in my 2nd combo box after selecting from my first combo box.  Not sure
[quoted text clipped - 27 lines]
>> >
>> >thanks in advance
Jana - 09 Jul 2007 21:59 GMT
On Jul 9, 11:26 am, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Unfortunately, none of us can offer any suggestions without knowing what
> you've tried so far.
[quoted text clipped - 39 lines]
>
> - Show quoted text -

Jenny:

Try putting square brackets around your table name in your SQL:
cbocounty.RowSource = "Select [tblCounty-ST].Cty " & _
           "FROM [tblCounty-ST] " & _
           "WHERE [tblCounty-ST].ST = '" & cbostate.Value & "' " & _
           "ORDER BY [tblCountry-ST].Cty;"

HTH,
Jana
 
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.