Code cannot find the field...

  • Thread starter Thread starter Rashar Sharro via AccessMonster.com
  • Start date Start date
R

Rashar Sharro via AccessMonster.com

Hi,

I have some code that looks for a form that it cannot find. What happens, is
that I enter a value in my sfrmProducts, and when I go to enter another value,
I get the message,

"Microsoft Access can't find the field referred to in your expression. You
may have misspelled the field name, or the field may have been renamed or
deleted"

I have ensured that all forms are spelled correctly.

I have a main form called frmLCORDER.

That main form has a subform called ChForm which source object is frmProducts.


In the frmProducts form lies another subform called sfrmProducts.

Can anyone verify the following code?

Set frm = Forms!frmLCORDER!ChForm!frmProducts!sfrmLawn_Care_Products.Form



Thank you.
 
When you have subforms, you need to reference the name of the subform
control rather than the name of the subform. They may or may not be the
same. So first thing you need to do is look to see what the names are of the
subform controls. Your syntax needs to be:
Set Frm = Forms!frmLCORDER!NameOfSubformControlHoldingCHForm.Form! _
NameOfSubformControlHoldingSFrmProducts.Form
 
Hi, Thanks for your reply.

I believe I have the correct names of my subforms controls. I verified it in
the properties of each form. Unless I am looking in the wrong place.
 
Hi, Thanks for your reply.

I tried your suggestion, but still no luck.
 
Actually,

this worked...

Set frm = Forms.frmLCORDER.ChForm.Form.sfrmLawn_Care_Products.Form

Why wouldn't the ! mark work?

Thanks for all your help.
 
Back
Top