Requery statements?

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

Guest

Hello,

I have a form with subform.

One of the combo box controls on the subform is based on a query which pulls
a product ID based on the customer ID (selected on the main form). I.e. each
customer has a predefined list of products they can order. The query for the
subform control has a criteria =[Forms]![Order Form].customerID.

This works fine for the first time the form is used. If, however, a new
customer ID is selected in the main form, the subform control (ProductID)
does not update and still shows the list of products available for the first
customer entered.

I imagine I need to put a Requery statement somewhere. I have tried doing
this but to no avail.

Can someone give me a hand?

Thanks,
Alex
 
Alex,

Issue the requery in the After Update event of CustomerID combo.

Me.[SubformControl].Form!ProductID.Requery

Brian
 
Hi Brian,

I have entered Private Sub Combo27_AfterUpdate()
Me.[SubformControl].Form!ProductID.Requery
End Sub

but I get an error message. Did you mean for the [SubformControl] to be
written as the specific field in the subform? Such as [ProductID]?

Thanks,
Alex.

Brian Bastl said:
Alex,

Issue the requery in the After Update event of CustomerID combo.

Me.[SubformControl].Form!ProductID.Requery

Brian


Alex said:
Hello,

I have a form with subform.

One of the combo box controls on the subform is based on a query which pulls
a product ID based on the customer ID (selected on the main form). I.e. each
customer has a predefined list of products they can order. The query for the
subform control has a criteria =[Forms]![Order Form].customerID.

This works fine for the first time the form is used. If, however, a new
customer ID is selected in the main form, the subform control (ProductID)
does not update and still shows the list of products available for the first
customer entered.

I imagine I need to put a Requery statement somewhere. I have tried doing
this but to no avail.

Can someone give me a hand?

Thanks,
Alex
 
No, I meant that you should use the name of your subform control.

Brian


Alex said:
Hi Brian,

I have entered Private Sub Combo27_AfterUpdate()
Me.[SubformControl].Form!ProductID.Requery
End Sub

but I get an error message. Did you mean for the [SubformControl] to be
written as the specific field in the subform? Such as [ProductID]?

Thanks,
Alex.

Brian Bastl said:
Alex,

Issue the requery in the After Update event of CustomerID combo.

Me.[SubformControl].Form!ProductID.Requery

Brian


Alex said:
Hello,

I have a form with subform.

One of the combo box controls on the subform is based on a query which pulls
a product ID based on the customer ID (selected on the main form).
I.e.
each
customer has a predefined list of products they can order. The query
for
the
subform control has a criteria =[Forms]![Order Form].customerID.

This works fine for the first time the form is used. If, however, a new
customer ID is selected in the main form, the subform control (ProductID)
does not update and still shows the list of products available for the first
customer entered.

I imagine I need to put a Requery statement somewhere. I have tried doing
this but to no avail.

Can someone give me a hand?

Thanks,
Alex
 
Hi,

I am getting a bit confused here.

The customer ID is on the main form;
The productID combo box is on the subform.

The productID combo box presents data based on the customerID in the main
form.

I cannot get the code, below, to work. I am probably being a bit dense
here, but can you restate the code, with more explanation?

Thanks,
Alex


Brian Bastl said:
Alex,

Issue the requery in the After Update event of CustomerID combo.

Me.[SubformControl].Form!ProductID.Requery

Brian


Alex said:
Hello,

I have a form with subform.

One of the combo box controls on the subform is based on a query which pulls
a product ID based on the customer ID (selected on the main form). I.e. each
customer has a predefined list of products they can order. The query for the
subform control has a criteria =[Forms]![Order Form].customerID.

This works fine for the first time the form is used. If, however, a new
customer ID is selected in the main form, the subform control (ProductID)
does not update and still shows the list of products available for the first
customer entered.

I imagine I need to put a Requery statement somewhere. I have tried doing
this but to no avail.

Can someone give me a hand?

Thanks,
Alex
 
Hi,

I figured it out! Will wonders never cease!

Private Sub ProductID_Enter()
Me.ProductID.Requery
End Sub
 

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

Back
Top