Requery Combo Box

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

Guest

What is wrong with the following code? It comes up with the error
frmsuppliermenu cannot be found....the name is definately correct as i paster
from database window. I have also tried wrapping the object names in [] but
this didnt help.

Forms!frmSupplierMenu!subfrmContractsDetails!cboOwner.Requery

Can anyone help...this has been driving me crazy for the past 2 hours now!!!

Thanks
 
Here's how to debug this.

1. Press Ctrl+G to open the Immediate window.

2. Enter:
? Forms!frmSupplierMenu.Name
If that fails, the name is incorrect, or the form is not open.

3. Once that's working, try:
? Forms!frmSupplierMenu.subformContractDetails.Name
If that fails, open the frmSupplierMenu form in design view, right-click on
the subform control and choose Properties. What is the Name of the subform
control? It can be different from the name of the form that gets loaded into
the control (i.e. its SourceObject).

4. Once that's working, try:
? Forms!frmSupplierMenu.subformContractDetails.Form!cboOwner.Name

Once you get that working, you should be able to get the Requery happening.
 
Hi,

The correct and full way to refer to a contol on a sub form is:

Forms("Your Form Name")("Subform Control Name").Form.Controls("Your Control
Name")

So try

Forms("frmSupplierMenu")("subfrmContractsDetails").Form.Controls("cboOwner").Requery


--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
 
Back
Top