I 'believe' That Employees3 is the subform control and the
form resides "inside" the control. The problem I have is
that I cannot determine what it is that I am looking at or
sometimes even what it's name is, since neither the name
of the control or the type of control are necessarily
listed in the properties box. My question was how do you
determine how to reference an unknown object. Somewhere
there ought to be an inventory of objects, names and
properties.
The format:
Forms![Supervisors]![Employees3].Form.AllowEdits = False
came from a KB article which describes this problem. I
can't understand why this call out works in one section of
the code and farther down the same page it doesn't work.
Meanwhile on another exact duplicate of the mdb in another
directory, it works fine.
I never did resolve the problem and I finally copied the
entire mdb from the file that worked to the one that
didn't. I like to copy my working database, make changes
on the copy, and once it is working and provided it
doesn't blow up, then copy just the changes back to the
original DB. In this case the changes worked fine in the
copy and mostly worked fine in the original except for the
one line I quoted.
I know it's not supposed to be that way, but I'm a firm
believer in Gremlins.
-----Original Message-----
Hi,
In looking at your reference again, are you in fact trying to reference a subform?
Please explain exactly what your form setup is.
Is Employees3 a subform control on Supervisors?
The more detail you supply, the more likely you are to
get a response that will solve your problem.
Dan Artuso, MVP
Nope, if I do that I get the message "Object doesn't
support this property or method." Anyway, that doesn't
explain why it works on the form's Open event.
Dan Artuso Wrote:
Hi,
The 'Form' property is used to get a reference to a
subform from it's container.
If this is just a main form, that property doesn't make
any sense.
In other words, you already have a reference to the form
with:
Forms![Supervisors]![Employees3].AllowEdits = False
HTH
Dan Artuso, MVP
I have a View/Edit button on my form that restricts the
data that each department is allowed to edit. In the code
on the event for that button is the following line:
Forms![Supervisors]![Employees3].Form.AllowEdits = True
It gives the error message:
You entered an expression that has an improper reference
to the property Form/Report.
In the on open event of the form I have the following
code
which does not give an error:
Forms![Supervisors]![Employees3].Form.AllowEdits = False
In addition I have another copy of this database where
the
same code runs without error.
I cannot find any differences in the names of the forms
or
the containers that might have been introduced. The forms
appear exactly the same. I have examined the properties
of
the forms and subforms and cannot find any differences.
The code for the working form is exactly the same as the
non-working one. I copied it to the non-working form and
replaced the existing code and it gives the same message.
I have not yet copied the entire working form, code and
all. The working form is in my unsecured copy of the
database. If I copy it over, will it cause ownership
problems? Without copying the working form, how can I
determine what the correct references should be?
.