A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo box value determined by the value of another combo box



 
 
Thread Tools Display Modes
  #1  
Old July 8th, 2004, 03:51 PM
LouD
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.
  #2  
Old July 8th, 2004, 04:30 PM
fredg
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event:
CityComboBox.RowSource = "Select TableName.[City] from TableName Where
TableName.State = '" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of the
State ComboBox.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old July 8th, 2004, 04:30 PM
fredg
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event:
CityComboBox.RowSource = "Select TableName.[City] from TableName Where
TableName.State = '" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of the
State ComboBox.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #4  
Old July 8th, 2004, 07:02 PM
LouD
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

Thanks Fred,
But I'm still a little confused because of the analogy that I gave you.
Here are the names of the table and the fields that I have:
Table Name is EW7. I have two fields in that table one is NodeType (column 1) the other is Cut (column 2).
On the form the name of the combo boxes are Cut (first combo box) and NodeType (second
combo box)
I want the choice from the first combo box to effect what is in the second combo box.
please reply again, Thanks.
Lou

"fredg" wrote:

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event:
CityComboBox.RowSource = "Select TableName.[City] from TableName Where
TableName.State = '" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of the
State ComboBox.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

  #5  
Old July 8th, 2004, 07:02 PM
LouD
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

Thanks Fred,
But I'm still a little confused because of the analogy that I gave you.
Here are the names of the table and the fields that I have:
Table Name is EW7. I have two fields in that table one is NodeType (column 1) the other is Cut (column 2).
On the form the name of the combo boxes are Cut (first combo box) and NodeType (second
combo box)
I want the choice from the first combo box to effect what is in the second combo box.
please reply again, Thanks.
Lou

"fredg" wrote:

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event:
CityComboBox.RowSource = "Select TableName.[City] from TableName Where
TableName.State = '" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of the
State ComboBox.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

  #6  
Old July 8th, 2004, 07:42 PM
fredg
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

On Thu, 8 Jul 2004 11:02:01 -0700, LouD wrote:

Thanks Fred, But I'm still a little confused because of the analogy
that I gave you. Here are the names of the table and the fields
that I have: Table Name is EW7. I have two fields in that table
one is NodeType (column 1) the other is Cut (column 2). On the form
the name of the combo boxes are Cut (first combo box) and NodeType
(second combo box) I want the choice from the first combo box to
effect what is in the second combo box. please reply again, Thanks.
Lou

"fredg" wrote:

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the
list of values in the next combo box? For example, if I have the
first combo box bound to a table with the name of the 50 States
in it, and I select New York in that combo box, and then in the
following combo box only the cities in New York would be
available to choose. So, what I need is a way to have the second
combo box know what table to look up values in, based on what the
value in the previous combo box is. If anyone could help, I would
really appreciate it. Thank you. Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event: CityComboBox.RowSource
= "Select TableName.[City] from TableName Where TableName.State =
'" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of
the State ComboBox.
--
Fred Please only reply to this newsgroup. I do not reply to
personal email.


I would suggest you change the name of the combos to something like
"cboCut" and "cboNodeType" so as not to confuse Access, as you have
fields of the same name.

Set the [cboNodeType] Combo box (the second combo) Row Source Type
property to Table/Query.
Leave the [cboNodeType] combo box Rowsource blank.

Code the [cboCut] combo box AfterUpdate event:

[cboNodeCut].Rowsource = "Select EW7.NodeType from EW7 Where EW7.Cut =
'" & Me![cboCut] & "' Order by [NodeType];"

With spaces added for clarity here is how the single quotes and double
quotes are placed:
Where EW7.Cut = ' " & Me![cboCut] & " ' Order by [NodeType];"


If I've mixed up the actual field names, just interchange them.

The above code assumes the value shown in the [cboCut] combo box is
Text datatype.
I hope this helps.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #7  
Old July 8th, 2004, 07:42 PM
fredg
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

On Thu, 8 Jul 2004 11:02:01 -0700, LouD wrote:

Thanks Fred, But I'm still a little confused because of the analogy
that I gave you. Here are the names of the table and the fields
that I have: Table Name is EW7. I have two fields in that table
one is NodeType (column 1) the other is Cut (column 2). On the form
the name of the combo boxes are Cut (first combo box) and NodeType
(second combo box) I want the choice from the first combo box to
effect what is in the second combo box. please reply again, Thanks.
Lou

"fredg" wrote:

On Thu, 8 Jul 2004 07:51:03 -0700, LouD wrote:

Is there any way to have the value of one combo box determine the
list of values in the next combo box? For example, if I have the
first combo box bound to a table with the name of the 50 States
in it, and I select New York in that combo box, and then in the
following combo box only the cities in New York would be
available to choose. So, what I need is a way to have the second
combo box know what table to look up values in, based on what the
value in the previous combo box is. If anyone could help, I would
really appreciate it. Thank you. Lou.


Leave the Cities Combo Box RowSource property blank.

Code the State Combo box AfterUpdate event: CityComboBox.RowSource
= "Select TableName.[City] from TableName Where TableName.State =
'" & Me!StateCombo & "' Order By [City];"

The above assumes the State name (as Text) is the bound column of
the State ComboBox.
--
Fred Please only reply to this newsgroup. I do not reply to
personal email.


I would suggest you change the name of the combos to something like
"cboCut" and "cboNodeType" so as not to confuse Access, as you have
fields of the same name.

Set the [cboNodeType] Combo box (the second combo) Row Source Type
property to Table/Query.
Leave the [cboNodeType] combo box Rowsource blank.

Code the [cboCut] combo box AfterUpdate event:

[cboNodeCut].Rowsource = "Select EW7.NodeType from EW7 Where EW7.Cut =
'" & Me![cboCut] & "' Order by [NodeType];"

With spaces added for clarity here is how the single quotes and double
quotes are placed:
Where EW7.Cut = ' " & Me![cboCut] & " ' Order by [NodeType];"


If I've mixed up the actual field names, just interchange them.

The above code assumes the value shown in the [cboCut] combo box is
Text datatype.
I hope this helps.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #8  
Old July 9th, 2004, 08:45 PM
LouD
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

Hello Fred,
I just wanted to say thank you. I couldn't have done it with out you. Here is the final result of the code that actually worked.

[cboNodeType].RowSource = "Select EW7.NodeType from EW7 Where EW7.cut = '" & Me![cbocut] & "' Group by [NodeType];"

"LouD" wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.

  #9  
Old July 9th, 2004, 08:45 PM
LouD
external usenet poster
 
Posts: n/a
Default Combo box value determined by the value of another combo box

Hello Fred,
I just wanted to say thank you. I couldn't have done it with out you. Here is the final result of the code that actually worked.

[cboNodeType].RowSource = "Select EW7.NodeType from EW7 Where EW7.cut = '" & Me![cbocut] & "' Group by [NodeType];"

"LouD" wrote:

Is there any way to have the value of one combo box determine the list of values in the next combo box? For example, if I have the first combo box bound to a table with the name of the 50 States in it, and I select New York in that combo box, and then in the following combo box only the cities in New York would be available to choose. So, what I need is a way to have the second combo box know what table to look up values in, based on what the value in the previous combo box is.
If anyone could help, I would really appreciate it. Thank you.
Lou.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering records using multiple combo boxes Mark Senibaldi Using Forms 0 June 17th, 2004 03:55 PM
Cascading Combo Boxes Tom Using Forms 1 June 9th, 2004 02:04 AM
Cascading Combo Boxes Tom Using Forms 0 June 8th, 2004 09:24 PM
Combo Box Problem Charles Using Forms 0 May 28th, 2004 09:15 PM
Multiple combo boxes Lee Worksheet Functions 2 May 6th, 2004 02:49 PM


All times are GMT +1. The time now is 09:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.