field not by that name

  • Thread starter Thread starter seeker
  • Start date Start date
S

seeker

the following piece of code is intended to requery a subform
(frmcustomerlist) after a new customer is added. The following error occurs
--

there is not field named forms!frmsearchkeynamedoslook!frmcustomerlist in
the current record

when this code is reached

docmd.requery "forms!frmsearchkeynamedoslook!fromcustomerlist

It is true there is not a field by that name because that is the subform i
am wanting to requery. I even tried forms!frmsearchkeynamedoslook and the
same error occured -- there is not a field named forms!frmsearchkeynamedoslook

what am I missing. Thanks.
 
On Tue, 2 Mar 2010 19:33:02 -0800, seeker

There is a common confusion about subforms because two concepts are
mixed up:
1: the subform CONTROL has a name
2: the form inside of the subform control has a name (which is set by
the SourceObject property of the subform control).

If you want to requery the subform, you need to "step into" the
subform control and access that form:
forms!myForm!mySubformControl.Form.Requery

-Tom.
Microsoft Access MVP




(original message follows)
the following piece of code is intended to requery a subform
(frmcustomerlist) after a new customer is added. The following error
occurs
--

there is not field named forms!frmsearchkeynamedoslook!frmcustomerlist
in
the current record

when this code is reached

docmd.requery "forms!frmsearchkeynamedoslook!fromcustomerlist

It is true there is not a field by that name because that is the
subform i
am wanting to requery. I even tried forms!frmsearchkeynamedoslook and
the
same error occured -- there is not a field named
forms!frmsearchkeynamedoslook

what am I missing. Thanks.
 
Thank you Tom. I replaced the docmd line with
Forms!frmsearchkeynamedoslook!frmCustomerList.frmcustomerlistdoslook.Requery

error message this object does not support this property or method.
 
Thank you Tom. I replaced the docmd line with
Forms!frmsearchkeynamedoslook!frmCustomerList.frmcustomerlistdoslook.Requery

error message this object does not support this property or method.

Try

Forms!frmsearchkeynamedoslook!frmCustomerList.Requery

or

Forms!frmsearchkeynamedoslook!frmCustomerList.Form.Requery

assuming that the name of the subform control (which may NOT be the name of
the form within that control) is frmCustomerList.
 
that did the trick. thanks.

John W. Vinson said:
Try

Forms!frmsearchkeynamedoslook!frmCustomerList.Requery

or

Forms!frmsearchkeynamedoslook!frmCustomerList.Form.Requery

assuming that the name of the subform control (which may NOT be the name of
the form within that control) is frmCustomerList.
--

John W. Vinson [MVP]

.
 
On Wed, 3 Mar 2010 19:18:01 -0800, seeker

Probably because you did not follow my instructions:
forms!myForm!mySubformControl.Form.Requery
For example your expression does no have a ".Form" part in it.

-Tom.
Microsoft Access MVP
 
Back
Top