Container/forms reference

  • Thread starter Thread starter Miaplacidus
  • Start date Start date
M

Miaplacidus

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?
 
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
 
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.
-----Original Message-----
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?


.
 
Now I have copied the entire working form from the
development database into the working database, code and
all. It works in the development database, not in the
working database.


-----Original Message-----
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?


.
 
Back
Top