Requery combo box

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
 
G

Guest

Try

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

replacing "form name" and "field name"
 
D

Douglas J. Steele

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?
 
B

Bob Quintal

=?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.
 
G

Guest

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
 

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