Combo box doesn't show correct field

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

Guest

I am trying to create a combo box that shows selections based on another
combo box. I found great help in the discussion groups and have followed
through all the instructions however, I must be making a mistake somewhere
because in the second combo box what appears in the dropdown is the ID # for
the first combo box.

For example if I select a "Type" in Combo Box 1 that has an ID of 37 and
should have 5 selections in Combo Box 2 what I will see in Combo Box 2 is the
number 37 five times.

I'm sure this is very easy to fix but I'm lost. Thanks for the help!
 
sounds like you might have set the column widths incorrectly. rather than
guessing, suggest you post the SQL statement from your 2nd combo box's
RowSource. also tell us the name of the field you *want* to see in the combo
box, and the settings of the ColumnCount, ColumnWidths, and BoundColumn
properties of the second combo box.

hth
 
Thanks Tina, you were right I actually didn't have any width set for my third
column so I added that and set the other 2 columns to 0. Now I'm seeing the
correct field but I am unable to select it. At the bottom of the page it
says because it's bound to the expression. Here is my Query:

SELECT Enforcement_Subtypes.Enf_Subtype_ID,
Enforcement_Subtypes.Enf_Type_ID, Enforcement_Subtypes.Enforcement_SubType
FROM Enforcement_Subtypes
WHERE
(((Enforcement_Subtypes.Enf_Type_ID)=[Forms]![Compl_MAIN_Form]![Enforcement
Type]));

And here is the Control Source of the field:

=Link_Enf!Enf_Subtype_ID

Here is the Row Source:

Link_Enf

Thanks
 
i assume the name of the Query you posted, is Link_Enf ?

the ControlSource of the *control*, the combo box, is set to an expression.
that makes it an unbound, calculated control. by definition, you can't
change the value of a calculated control through data entry. if you want to
be able to choose a value from the combo box control's droplist, you need to
remove the expression from the ControlSource.

furthermore, if you want to be able to save the value you select from the
droplist, into the current record on the form, you need to "bind" the
control to a field in the form's RecordSource - that is, you need to set the
control's ControlSource to a field that shows in the form's Field List.

hth


carriey said:
Thanks Tina, you were right I actually didn't have any width set for my third
column so I added that and set the other 2 columns to 0. Now I'm seeing the
correct field but I am unable to select it. At the bottom of the page it
says because it's bound to the expression. Here is my Query:

SELECT Enforcement_Subtypes.Enf_Subtype_ID,
Enforcement_Subtypes.Enf_Type_ID, Enforcement_Subtypes.Enforcement_SubType
FROM Enforcement_Subtypes
WHERE
(((Enforcement_Subtypes.Enf_Type_ID)=[Forms]![Compl_MAIN_Form]![Enforcement
Type]));

And here is the Control Source of the field:

=Link_Enf!Enf_Subtype_ID

Here is the Row Source:

Link_Enf

Thanks

tina said:
sounds like you might have set the column widths incorrectly. rather than
guessing, suggest you post the SQL statement from your 2nd combo box's
RowSource. also tell us the name of the field you *want* to see in the combo
box, and the settings of the ColumnCount, ColumnWidths, and BoundColumn
properties of the second combo box.

hth


#
for is
the
 
Hi Tina,

The name of my query is Link_Enf. The instructions I was following
originally said to create the Query and set the Control Source to the query.
It also said to put the following in the After Update of my first combo box:

Private Sub Enforcement_Type_AfterUpdate()
Me!Enforcement_SubType.Requery
End Sub

I have now removed the Control Source expression per your notes and put it
back to the filed Enforcement_Subtype from my main table. Now I am able to
select both the Enforcement_Type and the Enforcement_SubType with the correct
values showing but if I try to change them I get Run-time error '438' Object
doesn't support this property or method and it takes me to the After Update
code.

Any ideas what I am still doing wrong? Enforcement_SubType in my Main Table
is a look up to the Enforcement_SubType Table


tina said:
i assume the name of the Query you posted, is Link_Enf ?

the ControlSource of the *control*, the combo box, is set to an expression.
that makes it an unbound, calculated control. by definition, you can't
change the value of a calculated control through data entry. if you want to
be able to choose a value from the combo box control's droplist, you need to
remove the expression from the ControlSource.

furthermore, if you want to be able to save the value you select from the
droplist, into the current record on the form, you need to "bind" the
control to a field in the form's RecordSource - that is, you need to set the
control's ControlSource to a field that shows in the form's Field List.

hth


carriey said:
Thanks Tina, you were right I actually didn't have any width set for my third
column so I added that and set the other 2 columns to 0. Now I'm seeing the
correct field but I am unable to select it. At the bottom of the page it
says because it's bound to the expression. Here is my Query:

SELECT Enforcement_Subtypes.Enf_Subtype_ID,
Enforcement_Subtypes.Enf_Type_ID, Enforcement_Subtypes.Enforcement_SubType
FROM Enforcement_Subtypes
WHERE
(((Enforcement_Subtypes.Enf_Type_ID)=[Forms]![Compl_MAIN_Form]![Enforcement
Type]));

And here is the Control Source of the field:

=Link_Enf!Enf_Subtype_ID

Here is the Row Source:

Link_Enf

Thanks

tina said:
sounds like you might have set the column widths incorrectly. rather than
guessing, suggest you post the SQL statement from your 2nd combo box's
RowSource. also tell us the name of the field you *want* to see in the combo
box, and the settings of the ColumnCount, ColumnWidths, and BoundColumn
properties of the second combo box.

hth


I am trying to create a combo box that shows selections based on another
combo box. I found great help in the discussion groups and have followed
through all the instructions however, I must be making a mistake somewhere
because in the second combo box what appears in the dropdown is the ID #
for
the first combo box.

For example if I select a "Type" in Combo Box 1 that has an ID of 37 and
should have 5 selections in Combo Box 2 what I will see in Combo Box 2 is
the
number 37 five times.

I'm sure this is very easy to fix but I'm lost. Thanks for the help!
 
first of all, if you have a Lookup field in any table, suggest you get rid
of it - they're a major headache. convert a lookup field to a "regular"
field by opening the table in design view. go to the field that has the
Lookup on it. click the Lookup table under Field Properties, and change the
Display Control property to Text Box.

the Lookup field setting in your table may or may not be causing the error
you're getting in the form. if you still get the error after removing the
Lookup from the table, then open the form in design view and take a look at
the *name* property of the combo box that is bound to the field
Enforcement_Subtype. the control name may be the same as the fieldname it's
bound to, or it may be different. if they're different, make sure that the
code in the AfterUpdate event of the first combo box uses the control *name*
rather than the field name, as

Private Sub Enforcement_Type_AfterUpdate()

Me!MySubtypeComboBoxNAME.Requery

End Sub

hth


carriey said:
Hi Tina,

The name of my query is Link_Enf. The instructions I was following
originally said to create the Query and set the Control Source to the query.
It also said to put the following in the After Update of my first combo box:

Private Sub Enforcement_Type_AfterUpdate()
Me!Enforcement_SubType.Requery
End Sub

I have now removed the Control Source expression per your notes and put it
back to the filed Enforcement_Subtype from my main table. Now I am able to
select both the Enforcement_Type and the Enforcement_SubType with the correct
values showing but if I try to change them I get Run-time error '438' Object
doesn't support this property or method and it takes me to the After Update
code.

Any ideas what I am still doing wrong? Enforcement_SubType in my Main Table
is a look up to the Enforcement_SubType Table


tina said:
i assume the name of the Query you posted, is Link_Enf ?

the ControlSource of the *control*, the combo box, is set to an expression.
that makes it an unbound, calculated control. by definition, you can't
change the value of a calculated control through data entry. if you want to
be able to choose a value from the combo box control's droplist, you need to
remove the expression from the ControlSource.

furthermore, if you want to be able to save the value you select from the
droplist, into the current record on the form, you need to "bind" the
control to a field in the form's RecordSource - that is, you need to set the
control's ControlSource to a field that shows in the form's Field List.

hth


carriey said:
Thanks Tina, you were right I actually didn't have any width set for
my
third
column so I added that and set the other 2 columns to 0. Now I'm
seeing
the
correct field but I am unable to select it. At the bottom of the page it
says because it's bound to the expression. Here is my Query:

SELECT Enforcement_Subtypes.Enf_Subtype_ID,
Enforcement_Subtypes.Enf_Type_ID, Enforcement_Subtypes.Enforcement_SubType
FROM Enforcement_Subtypes
WHERE
(((Enforcement_Subtypes.Enf_Type_ID)=[Forms]![Compl_MAIN_Form]![Enforcement
Type]));

And here is the Control Source of the field:

=Link_Enf!Enf_Subtype_ID

Here is the Row Source:

Link_Enf

Thanks

:

sounds like you might have set the column widths incorrectly. rather than
guessing, suggest you post the SQL statement from your 2nd combo box's
RowSource. also tell us the name of the field you *want* to see in
the
combo
box, and the settings of the ColumnCount, ColumnWidths, and BoundColumn
properties of the second combo box.

hth


I am trying to create a combo box that shows selections based on another
combo box. I found great help in the discussion groups and have followed
through all the instructions however, I must be making a mistake somewhere
because in the second combo box what appears in the dropdown is
the ID
#
for
the first combo box.

For example if I select a "Type" in Combo Box 1 that has an ID of
37
and
should have 5 selections in Combo Box 2 what I will see in Combo
Box 2
is
the
number 37 five times.

I'm sure this is very easy to fix but I'm lost. Thanks for the help!
 
thanks tina - that fixed my problem - never would've figured it out on my own!

tina said:
first of all, if you have a Lookup field in any table, suggest you get rid
of it - they're a major headache. convert a lookup field to a "regular"
field by opening the table in design view. go to the field that has the
Lookup on it. click the Lookup table under Field Properties, and change the
Display Control property to Text Box.

the Lookup field setting in your table may or may not be causing the error
you're getting in the form. if you still get the error after removing the
Lookup from the table, then open the form in design view and take a look at
the *name* property of the combo box that is bound to the field
Enforcement_Subtype. the control name may be the same as the fieldname it's
bound to, or it may be different. if they're different, make sure that the
code in the AfterUpdate event of the first combo box uses the control *name*
rather than the field name, as

Private Sub Enforcement_Type_AfterUpdate()

Me!MySubtypeComboBoxNAME.Requery

End Sub

hth


carriey said:
Hi Tina,

The name of my query is Link_Enf. The instructions I was following
originally said to create the Query and set the Control Source to the query.
It also said to put the following in the After Update of my first combo box:

Private Sub Enforcement_Type_AfterUpdate()
Me!Enforcement_SubType.Requery
End Sub

I have now removed the Control Source expression per your notes and put it
back to the filed Enforcement_Subtype from my main table. Now I am able to
select both the Enforcement_Type and the Enforcement_SubType with the correct
values showing but if I try to change them I get Run-time error '438' Object
doesn't support this property or method and it takes me to the After Update
code.

Any ideas what I am still doing wrong? Enforcement_SubType in my Main Table
is a look up to the Enforcement_SubType Table


tina said:
i assume the name of the Query you posted, is Link_Enf ?

the ControlSource of the *control*, the combo box, is set to an expression.
that makes it an unbound, calculated control. by definition, you can't
change the value of a calculated control through data entry. if you want to
be able to choose a value from the combo box control's droplist, you need to
remove the expression from the ControlSource.

furthermore, if you want to be able to save the value you select from the
droplist, into the current record on the form, you need to "bind" the
control to a field in the form's RecordSource - that is, you need to set the
control's ControlSource to a field that shows in the form's Field List.

hth


Thanks Tina, you were right I actually didn't have any width set for my
third
column so I added that and set the other 2 columns to 0. Now I'm seeing
the
correct field but I am unable to select it. At the bottom of the page it
says because it's bound to the expression. Here is my Query:

SELECT Enforcement_Subtypes.Enf_Subtype_ID,
Enforcement_Subtypes.Enf_Type_ID, Enforcement_Subtypes.Enforcement_SubType
FROM Enforcement_Subtypes
WHERE

(((Enforcement_Subtypes.Enf_Type_ID)=[Forms]![Compl_MAIN_Form]![Enforcement
Type]));

And here is the Control Source of the field:

=Link_Enf!Enf_Subtype_ID

Here is the Row Source:

Link_Enf

Thanks

:

sounds like you might have set the column widths incorrectly. rather
than
guessing, suggest you post the SQL statement from your 2nd combo box's
RowSource. also tell us the name of the field you *want* to see in the
combo
box, and the settings of the ColumnCount, ColumnWidths, and BoundColumn
properties of the second combo box.

hth


I am trying to create a combo box that shows selections based on
another
combo box. I found great help in the discussion groups and have
followed
through all the instructions however, I must be making a mistake
somewhere
because in the second combo box what appears in the dropdown is the ID
#
for
the first combo box.

For example if I select a "Type" in Combo Box 1 that has an ID of 37
and
should have 5 selections in Combo Box 2 what I will see in Combo Box 2
is
the
number 37 five times.

I'm sure this is very easy to fix but I'm lost. Thanks for the help!
 
Back
Top