restricted choice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Tables: Workouts(Workout_ID, Date, Intensity
Exercise Types(Exercise_Type_ID, Exercise_Type_Name) - ex: Cardi
Exercises(Exercise_ID, Exercise_Name, Exercise_Type_ID) - ex: Bik
Workout Details(Workout_ID, Exercise_Type_ID, Exercise_ID

A workout includes more exercises of same type or different types
I have a form Workout which includes a subform WorkoutDetail. I want after I'm selecting an Exercise Type in the Exercise_Type_ID combo box (ex: Cardio), next to be able to select in the Exercise_ID combo box field only from values of the just selected exercises type

How can I do this
10x for any help !
 
Here are a couple of KB links regarding synchronizing combo boxes:

How to Synchronize Two Combo Boxes on a Form
http://support.microsoft.com/default.aspx?scid=kb;EN-US;289670

ACC: How to Synchronize Two Combo Boxes on a Form (97624)
http://support.microsoft.com/default.aspx?scid=kb;[LN];97624



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Mario said:
Tables: Workouts(Workout_ID, Date, Intensity)
Exercise Types(Exercise_Type_ID, Exercise_Type_Name) - ex: Cardio
Exercises(Exercise_ID, Exercise_Name, se_Type_ID) - ex: Bike
Workout Details(Workout_ID, Exercise_Type_ID, Exercise_ID)

A workout includes more exercises of same type or different types.
I have a form Workout which includes a subform WorkoutDetail. I want after
I'm selecting an Exercise Type in the Exercise_Type_ID combo box (ex:
Cardio), next to be able to select in the Exercise_ID combo box field only
from values of the just selected exercises type.
 
10x Cheryl Fischer for the help provided

I still have a little problem.I have 2 comboboxes, in the first (Exercise_Type_combo) I select the Exercise_Type and in the second(Exercise_combo) the exercise I want from that category. At AfterUpdate Propertiy of the Exercise_Type_combo I put [Event Procedure]
Private Sub Exercise_Type_combo_AfterUpdate(
Me.Exercise_combo.RowSource = "SELECT Exercise_Name FROM" &
" Exercises WHERE Exercise_Type_ID = " & Me.Exercise_Type_combo &
" ORDER BY Exercise_Name
Me.Exercise_combo = Me.Exercise_combo.ItemData(0

This function sets the Rowsource of the second combobox. It's working fine, the only problem is that the exercise which I selected in the second combobox I want it to apear in format Exercise_Name(like now), but when the info is stored in Workout Details table, to be in format Exercise_ID
I tried something, but :((
Private Sub Exercise_Type_combo_AfterUpdate(
Me.Exercise_combo.RowSource = "SELECT Exercise_ID AND Exercise_Name FROM" &
" Exercises WHERE Exercise_Type_ID = " & Me.Exercise_Type_combo &
" ORDER BY Exercise_Name
Me.Exercise_combo = Me.Exercise_combo.ItemData(0

Can you give me some help
thanks
 
Mario,

This sounds as if it's related to the Column Widths property in
Exercise_Combo - the widths are probably both greater than zero, probably
something like:

.8";.8"

Make the first entry a 0 and your combo will display the Exercise_Name
rather than ID.


hth,

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Mario said:
10x Cheryl Fischer for the help provided!

I still have a little problem.I have 2 comboboxes, in the first
(Exercise_Type_combo) I select the Exercise_Type and in the
second(Exercise_combo) the exercise I want from that category. At
AfterUpdate Propertiy of the Exercise_Type_combo I put [Event Procedure]:
Private Sub Exercise_Type_combo_AfterUpdate()
Me.Exercise_combo.RowSource = "SELECT Exercise_Name FROM" & _
" Exercises WHERE Exercise_Type_ID = " & Me.Exercise_Type_combo & _
" ORDER BY Exercise_Name"
Me.Exercise_combo = Me.Exercise_combo.ItemData(0)

This function sets the Rowsource of the second combobox. It's working
fine, the only problem is that the exercise which I selected in the second
combobox I want it to apear in format Exercise_Name(like now), but when the
info is stored in Workout Details table, to be in format Exercise_ID.
 
Take out the AND and substitute with a comma:

SELECT Exercise_ID, Exercise_Name



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Mario said:
The widths of the columns are k.
The problem is that the first function works (shows only Exercise_Name),
but the second function (with Exercise_ID AND Exercise_Name) works, but
"strange". It returns values in the combobox list all with ID -1 and Name
nothing.
 
Back
Top