Unbound ComboBox to Lookup Values in a Table based on a condition

G

Guest

I have an unbound Combobox called CID01, Option Group (FrameCT), and a table
that contains [Design] {text} and [CTCond] {Integer}. When the user selects
an item from the Option Group (FrameCT) I want the ComboBox only to show the
Values of [Design] where (frameCT) = (CTCond) in the table.

I am really struggling with how to make this work and am need of some
guidance? Can any one help?
 
J

Jeff Boyce

Heiko

Are you working in a form, or directly in a table?

If in a form, add an event procedure to the AfterUpdate event of the
OptionGroup. In that procedure, re-set the Record Source of the combobox.

You need to do this, rather than simply re-querying the combobox, because
your OptionGroup doesn't really = "(CTCond)" ... unless the values of that
field happen to be the actual underlying values of the option choices in the
group (typically =1 or =2). If the underlying field DOES hold 1 or 2, then
you can simply requery the combobox.

You'll need to modify the RecordSource of the combobox to look at the form's
OptionGroup for the criterion ... you're creating a parameter query, but the
parameter is found in the form.

Two notes: 1) the form has to be open for this to work, and 2) the field
in the table HAS to store the actual values of the options, not what their
labels say. If the field doesn't store the (say, 1, 2), you'll need to use
code in the AfterUpdate event to dynamically modify a SQL expression to use
as the RecordSource.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

kingston via AccessMonster.com

Use the Option Group's After Update event and the following:

Select Case Me.OptionGroup.Value
Case 1
Me.ComboBox.RowSource = SQLstring1
Case2
Me.ComboBox.RowSource = SQLstring2
...

HTH.
I have an unbound Combobox called CID01, Option Group (FrameCT), and a table
that contains [Design] {text} and [CTCond] {Integer}. When the user selects
an item from the Option Group (FrameCT) I want the ComboBox only to show the
Values of [Design] where (frameCT) = (CTCond) in the table.

I am really struggling with how to make this work and am need of some
guidance? Can any one help?
 
G

Guest

Thanks...That worked....I actually already had that and just wasn't getting
the right results, only to find out another event was over riding it.

Thanks
--
Heiko K Stugg


kingston via AccessMonster.com said:
Use the Option Group's After Update event and the following:

Select Case Me.OptionGroup.Value
Case 1
Me.ComboBox.RowSource = SQLstring1
Case2
Me.ComboBox.RowSource = SQLstring2
...

HTH.
I have an unbound Combobox called CID01, Option Group (FrameCT), and a table
that contains [Design] {text} and [CTCond] {Integer}. When the user selects
an item from the Option Group (FrameCT) I want the ComboBox only to show the
Values of [Design] where (frameCT) = (CTCond) in the table.

I am really struggling with how to make this work and am need of some
guidance? Can any one help?
 
G

Guest

Follow up Question.

Now that I have the unbound Combobox see and limiting the values that I want
it to; for some reason it won't actually let me select anything. I do not
want the combobox to save the information to a table but I do need it to
store the information temporarily until after the user selects the command
"Save" Button.

Thanks for the help
--
Heiko K Stugg


Heiko K Stugg said:
Thanks...That worked....I actually already had that and just wasn't getting
the right results, only to find out another event was over riding it.

Thanks
--
Heiko K Stugg


kingston via AccessMonster.com said:
Use the Option Group's After Update event and the following:

Select Case Me.OptionGroup.Value
Case 1
Me.ComboBox.RowSource = SQLstring1
Case2
Me.ComboBox.RowSource = SQLstring2
...

HTH.
I have an unbound Combobox called CID01, Option Group (FrameCT), and a table
that contains [Design] {text} and [CTCond] {Integer}. When the user selects
an item from the Option Group (FrameCT) I want the ComboBox only to show the
Values of [Design] where (frameCT) = (CTCond) in the table.

I am really struggling with how to make this work and am need of some
guidance? Can any one help?
 
K

kingston via AccessMonster.com

What happens when you try to make a selection? If you make a selection and
the combobox displays a blank, check the formatting of the combo box. What
is the control source of the combobox (it should be blank)? What is the row
source of the combo box? Verify that the control is enabled and not locked.
Is there any code that you forgot about preventing this from working? HTH.
Follow up Question.

Now that I have the unbound Combobox see and limiting the values that I want
it to; for some reason it won't actually let me select anything. I do not
want the combobox to save the information to a table but I do need it to
store the information temporarily until after the user selects the command
"Save" Button.

Thanks for the help
Thanks...That worked....I actually already had that and just wasn't getting
the right results, only to find out another event was over riding it.
[quoted text clipped - 19 lines]
 

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