Combo Requery Question

L

LJG

Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main products
form [frmProducts] if the product is not in the combo list. I want the combo
box on frmInvoice to requery and update to include any new products added to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub
 
R

Ron Hinds

LJG said:
Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main products
form [frmProducts] if the product is not in the combo list. I want the combo
box on frmInvoice to requery and update to include any new products added to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub

Shouldn't it be:

Forms!frmInvoice!cboProducts.Requery
 
L

LJG

Sorry, I simplified my example for to explain the result I wanted.

The correct form names are included in the example of the onclick event.

So to further explain, the frmOrderPlacement has a subform, frmOrderItems
which has a combo box cboproducts, which I want to requery to include any
new products added via the products form.

I wanted to ensure I had the correct syntax to target the requery in the
combo box.

Hope that makes it clearer.




Ron Hinds said:
LJG said:
Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main products
form [frmProducts] if the product is not in the combo list. I want the combo
box on frmInvoice to requery and update to include any new products added to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub

Shouldn't it be:

Forms!frmInvoice!cboProducts.Requery
 
R

Ron Hinds

LJG said:
Sorry, I simplified my example for to explain the result I wanted.

The correct form names are included in the example of the onclick event.

So to further explain, the frmOrderPlacement has a subform, frmOrderItems
which has a combo box cboproducts, which I want to requery to include any
new products added via the products form.

I wanted to ensure I had the correct syntax to target the requery in the
combo box.

Hope that makes it clearer.

Yes it does. The syntax is much more obscure for that. You need to use the
Name of the Subform *Control* (*not* the subfom's name) in place of
SubformName below:

Forms!frmOrderPlacement!SubformName!cboProducts.Requery
LJG said:
Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main products
form [frmProducts] if the product is not in the combo list. I want the combo
box on frmInvoice to requery and update to include any new products
added
to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub

Shouldn't it be:

Forms!frmInvoice!cboProducts.Requery
 
L

LJG

Hi Ron,

Afraid that suggestion did not work, as it requires the main form, subform
then control, yet for some reason it will not requery my cboProducts combo
box.

Any other suggestions? or resources I can find with regard to this?

Thanks
Les



Ron Hinds said:
LJG said:
Sorry, I simplified my example for to explain the result I wanted.

The correct form names are included in the example of the onclick event.

So to further explain, the frmOrderPlacement has a subform, frmOrderItems
which has a combo box cboproducts, which I want to requery to include any
new products added via the products form.

I wanted to ensure I had the correct syntax to target the requery in the
combo box.

Hope that makes it clearer.

Yes it does. The syntax is much more obscure for that. You need to use the
Name of the Subform *Control* (*not* the subfom's name) in place of
SubformName below:

Forms!frmOrderPlacement!SubformName!cboProducts.Requery
Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main
products
form [frmProducts] if the product is not in the combo list. I want the
combo
box on frmInvoice to requery and update to include any new products added
to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub

Shouldn't it be:

Forms!frmInvoice!cboProducts.Requery
 
R

Ron Hinds

OK, try this one then. It would be helpful if I knew the name of the Subform
Control:

Forms!frmOrderPlacement!SubformControlName.Form!frmOrderItems!cboProducts.Re
query

Unfortunately, I can't point you to any resources. I discovered this obscure
syntax by experimenting in the Debug (Ctrl-G) window until I obtained the
desired result. You might want to try that, too. Use the Name property of
the combo and precede it with a question mark (the for in question must be
open) until you hit on the right combo, like so:

?Forms!frmOrderPlacement!SubformControlName.Form!frmOrderItems!cboProducts.N
ame

LJG said:
Hi Ron,

Afraid that suggestion did not work, as it requires the main form, subform
then control, yet for some reason it will not requery my cboProducts combo
box.

Any other suggestions? or resources I can find with regard to this?

Thanks
Les



LJG said:
Sorry, I simplified my example for to explain the result I wanted.

The correct form names are included in the example of the onclick event.

So to further explain, the frmOrderPlacement has a subform, frmOrderItems
which has a combo box cboproducts, which I want to requery to include any
new products added via the products form.

I wanted to ensure I had the correct syntax to target the requery in the
combo box.

Hope that makes it clearer.

Yes it does. The syntax is much more obscure for that. You need to use the
Name of the Subform *Control* (*not* the subfom's name) in place of
SubformName below:

Forms!frmOrderPlacement!SubformName!cboProducts.Requery
Hi Guys,

I have an invoice form [frmInvoice] with a button to open the main
products
form [frmProducts] if the product is not in the combo list. I want the
combo
box on frmInvoice to requery and update to include any new products added
to
frmProducts.

On the close button for frmProducts I have added the following code to
requery the combo list on the frmInvoice, but it's not working!! any
suggestions please?


Private Sub cmdClose_Click()
DoCmd.Close
DoCmd.SetWarnings False
Forms!frmOrderPlacement!frmOrderItems!cboProducts.Requery
End Sub

Shouldn't it be:

Forms!frmInvoice!cboProducts.Requery
 

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