Requery combo box

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

Guest

I currently have a form that contains a combo box. I use this combo box to
select certain criteria for a subform. In the subform I have another combo
box, which I would like to be requeried based on the selection in the combo
box on the main form. I have tried using the following code in the after
update event for the combo box on the main form:

Me.[ComboBox2].Requery

It, however keeps giving me an error that it cannot find the field specified.

On the subform I use the code Me.[ComboBox3].Requery in the after update
event of combobox2 and it works ok.

Any suggestions would be appreciated.
Thank you
 
Try

[forms]![form name]![field name].form[combobox2].requery

replacing "form name" and "field name"
 
What's the rest of the code in the event?

Does the error message indicate the actual field which it cannot find? If
so, where is that field: on the same form or on a different form?
 
=?Utf-8?B?YWNjZXNzdXNlcjEzMDg=?=
I currently have a form that contains a combo box. I use this
combo box to select certain criteria for a subform. In the
subform I have another combo box, which I would like to be
requeried based on the selection in the combo box on the main
form. I have tried using the following code in the after update
event for the combo box on the main form:

Me.[ComboBox2].Requery

It, however keeps giving me an error that it cannot find the field
specified.

On the subform I use the code Me.[ComboBox3].Requery in the after
update event of combobox2 and it works ok.

Any suggestions would be appreciated.
Thank you

Since the combobox is on the subform, you have to specify the
hiearchy of the form (me! is the shortcut)
The subform control's name,(???)
the form in that subform coontrol, (form is the property)
then the name of the field.

so try
Me![child1].form![Combobox2].requery

I don't know the name that you are using for the control, but if you
created it by drag and drop from the toolbox, it'll be child plus a
number. If you created it with the wizard, it may be the name of the
form you put in the subform control. Either way, it's in the
control's name property.
 
Thank you, this worked as I wanted.

scubadiver said:
Try

[forms]![form name]![field name].form[combobox2].requery

replacing "form name" and "field name"

--
"Loose Change 2nd Edition" has been seen by almost 7 million people on
Google video


accessuser1308 said:
I currently have a form that contains a combo box. I use this combo box to
select certain criteria for a subform. In the subform I have another combo
box, which I would like to be requeried based on the selection in the combo
box on the main form. I have tried using the following code in the after
update event for the combo box on the main form:

Me.[ComboBox2].Requery

It, however keeps giving me an error that it cannot find the field specified.

On the subform I use the code Me.[ComboBox3].Requery in the after update
event of combobox2 and it works ok.

Any suggestions would be appreciated.
Thank you
 
Back
Top