Form Combo Box

G

Guest

I'd Like to have Several boxes base on one after the other. I'm able to
base one box on another in practice. But this only allows me to to select
out a subset of one column.

I need to be able to choose one or another column base on another number.

I have a Match Table, Score Table, Team Table, a Player Table and Possible
Position table ( the last at this point Just gives a column listing 1-10 that
I use to for a combo box on the form I'm working on ).

The Match Table Gives a Match ID number to individual matches and Has a
column for the Home Team and a column for the Away Team.

The Score Table, among other things, has a position column(a number 1-10).
Positions 1-5 are Home and Position 1-6 are Away.

So on my form if I have a Match Number and a Position Number with these two
Boxes I should be able to automatically fill a Team Box ( ie Match 5
Position 3 is filled by Match Table, Home Team column entry and Match 5
position 7 is filled by the Away Team coulmn entry.
I hope to use this Team Box to Base a Player Combo Box on.

P.S. I am basically keeping Individual scores in matchs ( I will have to
do queries and reports on indivduals) and using these individual scores to
also come up with Team Scores (with there own queries and reports) the
position number is used to calculate these team scores.

domdog
 
K

Ken Snell \(MVP\)

You can change the Row Source query of the second combo box so that it will
use the desired column from the first combo box as you wish. You can use the
AfterUpdate event of the first combo box to create a string that is the
desired Row Source query string for the second combo box and then set that
combo box's RowSource property to that.

For example, if you have a textbox on the form that has the identifying
number for which column to use:

Dim strRowSource As String
Select Case Me.TextBoxWithNumber.Value
Case 1
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(1)
Case 2
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(3)
Case 3
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(11)
End Select
Me.Combo2.RowSource = strRowSource
 
G

Guest

Ken Snell (MVP) said:
You can change the Row Source query of the second combo box so that it will
use the desired column from the first combo box as you wish. You can use the
AfterUpdate event of the first combo box to create a string that is the
desired Row Source query string for the second combo box and then set that
combo box's RowSource property to that.

For example, if you have a textbox on the form that has the identifying
number for which column to use:

Dim strRowSource As String
Select Case Me.TextBoxWithNumber.Value
Case 1
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(1)
Case 2
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(3)
Case 3
strRowSource = "SELECT * FROM MyTable WHERE " & _
"FieldName =" & Me.Combo1.Column(11)
End Select
Me.Combo2.RowSource = strRowSource

--

Ken Snell
<MS ACCESS MVP>





Thank You for the info.!!!!

I'm tackling another project right now so it'll be a while till I give this
a go. I'll let you know how it goes then.
 

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