cascading 3 cboboxes

J

Joanne

I have these two cboboxes in my app and the 'cascading' works great.
What I need is the coding for ThirdCboBox that would be using both of
the first two cboboxes to limit the choices available to the userin
the third cbobox , but I don't know how to construct the sql statement
to include two 'limit' criterias in one statement.
Please help me with this - I sure appreciate your time and expertise,
as always. You guys have made this project a fun and successful deal
for me.

First CboBox
Private Sub cboCoName_AfterUpdate()
Me!cboLocation.RowSource = "select tblmain.[location] from tblmain
where tblmain.[CoName] ='" & Me!cboCoName & "'"
Me.cboCoName.Requery
End Sub


SecondCboBox
Private Sub cboLocation_AfterUpdate()
Me!cboStreet.RowSource = "select tblmain.[street] from tblmain
where tblmain.[Location] ='" & Me!cboLocation & "'"
Me.cboStreet.Requery
End Sub
 
J

Joanne

As I look at this and try to figure it out it occurs to me that I
don't need code for the third cbobox. I think I need to extend the sql
statement in the second cboBox.

I tried this, without success :-(

SecondCboBox
Me!cboStreet.RowSource = "select tblmain.[street] from tblmain
where tblmain.[Location] ='" & Me!cboLocation & "'" And "select
tblmain.[street] from tblmain where tblmain.[CoName] = '"&
Me!cboCoName & "'"

What I am doing is first choose a Company, then the city they are in,
then their street (all from cboboxes). I can get the Company and the
particular city I want from my tables, but when I choose a street, I
get all streets from all companies in the city I chose. I would like
to get only the street(s) that are relevant to the company and city I
chose.

TIA
Joanne
 
J

Joanne

Sorry please excuse this post. I put it in the wrong group. Meant to
use the access programming group.
As I look at this and try to figure it out it occurs to me that I
don't need code for the third cbobox. I think I need to extend the sql
statement in the second cboBox.

I tried this, without success :-(

SecondCboBox
Me!cboStreet.RowSource = "select tblmain.[street] from tblmain
where tblmain.[Location] ='" & Me!cboLocation & "'" And "select
tblmain.[street] from tblmain where tblmain.[CoName] = '"&
Me!cboCoName & "'"

What I am doing is first choose a Company, then the city they are in,
then their street (all from cboboxes). I can get the Company and the
particular city I want from my tables, but when I choose a street, I
get all streets from all companies in the city I chose. I would like
to get only the street(s) that are relevant to the company and city I
chose.

TIA
Joanne


I have these two cboboxes in my app and the 'cascading' works great.
What I need is the coding for ThirdCboBox that would be using both of
the first two cboboxes to limit the choices available to the userin
the third cbobox , but I don't know how to construct the sql statement
to include two 'limit' criterias in one statement.
Please help me with this - I sure appreciate your time and expertise,
as always. You guys have made this project a fun and successful deal
for me.

First CboBox
Private Sub cboCoName_AfterUpdate()
Me!cboLocation.RowSource = "select tblmain.[location] from tblmain
where tblmain.[CoName] ='" & Me!cboCoName & "'"
Me.cboCoName.Requery
End Sub


SecondCboBox
Private Sub cboLocation_AfterUpdate()
Me!cboStreet.RowSource = "select tblmain.[street] from tblmain
where tblmain.[Location] ='" & Me!cboLocation & "'"
Me.cboStreet.Requery
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