error 2455: invalid reference to the property Form/Report.

M

M Skabialka

A form I have used for years in various versions of Access, now Access 2000
(for 2 yrs) suddenly gives me error 2455: "You entered an expression that
has an invalid reference to the property Form/Report."

I open Form1, which opens Form 2. I use Form 2 to update data for subForm1
on Form 1, then Form 2 closes.

subForm1 is not bound, so there is no control name for each field, only the
Field name.

The code which worked until now is:

Forms!Form1!subForm1.Controls(Me!ChartLocation) = "X"

where Me!ChartLocation = e.g. "X3Y4" representing a field on a chart on
subForm1 using XY co-ordinates, therefore:

Forms!Form1!subForm1.Controls("X3Y4") = "X"
which used to work as though it was

Forms!Form1!subForm1!X3Y4 = "X"

Now I get the error 2455.

I store the ChartLocation information only ("X3Y4"), and use it to place the
X on the chart.

Assuming I can't refer to the Control Name of the subForm1 field since it
isn't bound, how can I change it on subForm 1 so that it is up-to-date when
Form2 closes?

Sorry if this seems confusing - I am confused that it has been working so
long (even last week!) and now doesn't.
And all posts on newsgroups etc seem to have no resolution....
Thanks,
Mich
 
A

Allen Browne

Try adding the ".Form" bit to refer to the form in the subform control,
e.g.:
Forms.Form1.subForm1.Form.Controls(Me!ChartLocation) = "X"

If it still finds that too confusing, break out the control name as a
string:
Dim strControlName As String
strControlName = Me!ChartLocation
Forms.Form1.subForm1.Form.Controls(strControlName) = "X"
 
M

M Skabialka

Thanks, I tried these but it gives me the same error. I think the problem
is that although the subForm1 is bound; the value stored is the coordinate,
e.g. "X2Y3". There are 25 places on my XY chart that have the names X1Y1,
X1Y2 ...X5Y5. But they have no control name because they have no control
source - they are just there to display the XY value as an X for
informational purposes.

So when I use the Control keyword, although it worked before, Microsoft's
site insists it should never have worked, so I need a workaround.

Later---
I added a control source for each of the 25 fields, e.g. X2Y3:
iif([ChartLocation]="X2Y3","X","")
but then I got errors
"You cancelled the previous operation" and
"Module not found"

I tried compact and repairing, decompiling.... and finally went to a backup,
where I had to re-do all of my changes from the last few days.

This copy has the same code as what was giving me the above error, but it
works! So, I think I was getting the first symptoms of corruption, and it
went south from there.

Obviously more frequent backups needed!

Thanks for your help,
Mich
 

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