subform control reference fails

I

Imran J Khan

I have prexisting precedure with code to requery subforms:
frmSLSDetailSelect.Form.Requery
It used to work fine.
But now, after adding more code to change the color of some controls in
subforms that caused problems between the name of the subform control and the
subform name (control name "frmSlsDetail" and form name
"frmSlsDetailSelect"), changed the subform control name so it is the same as
the form name. The color change code works great, but now the code to requery
subforms fails with error
You entered an expression that has an invalid reference to the property
form/report.
I don't know what to do. Changing the subform and subform control name so
they are different does not help. I have already read the link
http://www.mvps.org/access/forms/frm0031.htm
But perhaps don't know how it can help me.
Imran
 
M

Marshall Barton

Imran said:
I have prexisting precedure with code to requery subforms:
frmSLSDetailSelect.Form.Requery
It used to work fine.
But now, after adding more code to change the color of some controls in
subforms that caused problems between the name of the subform control and the
subform name (control name "frmSlsDetail" and form name
"frmSlsDetailSelect"), changed the subform control name so it is the same as
the form name. The color change code works great, but now the code to requery
subforms fails with error
You entered an expression that has an invalid reference to the property
form/report.


Double check the lines that get an error and make sure they
all use the subform **control** name. The name of the form
displayed in the subform control should not be used anywhere
in your code.
 
I

Imran J Khan

I am using the control name not the form name. However, I have attempted to
resolve the issue by making the control name and the subform name the same
and then later different, neither made a difference.

imran
 
M

Marshall Barton

That error message implies that the control name is invalid.
Maybe you spelled it wrong or have a space or something that
looks similar, but is really a different name.

If you are absolutely certain (via Copy/Paste from one that
works) that the control names are identical for all the
references, then all I can do is cop out by blaming it on
corruption. If it is corrupted I suggest that you decompile
your project and/or importing everything to a new blank mdb
file (after making all the appropriate settings, especially
setting NameAutoCorrect OFF).
 

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