Trick Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have a form with a subform, and i'm using the vba command bellow to enable
and to unlock a certain control, but i get a run-time error 2455.

The command is
"Forms!MyFormName.MySubformName.Form.Controls!MyControl.Enabled=True"
And the same to Locked=False

What am i doing wrong?
 
Luis said:
Hello.
I have a form with a subform, and i'm using the vba command bellow to
enable and to unlock a certain control, but i get a run-time error
2455.

The command is
"Forms!MyFormName.MySubformName.Form.Controls!MyControl.Enabled=True"
And the same to Locked=False

What am i doing wrong?

Verify that "MySubformName" -- that is, the value you're really using in
this part of the reference -- is really the name of the subform
*control* on the main form, and not just the name of the form object
that the subform control is displaying.
 
Yes, i already checked that.

Dirk Goldgar said:
Verify that "MySubformName" -- that is, the value you're really using in
this part of the reference -- is really the name of the subform
*control* on the main form, and not just the name of the form object
that the subform control is displaying.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Luis said:
Yes, i already checked that.

What type of control is "MyControl"?

Can I safely assume that the main form is in fact open at the time you
execute this line of code?
 
The problem was on the recordset that is the recordsource of the form. There
was an error on the SQL command and therefore the run-time error occurs. I've
corrected the SQL command and the form worked perfectly.
The MyControl that i mentioned is a text box that when i load the form is
net enabled and locked.
 
Luis said:
The problem was on the recordset that is the recordsource of the
form. There was an error on the SQL command and therefore the
run-time error occurs. I've corrected the SQL command and the form
worked perfectly.
The MyControl that i mentioned is a text box that when i load the
form is net enabled and locked.

Interesting, because I wouldn't have expected that particular error
under those circumstances. Live and learn. Thanks. for the
explanation.
 
Back
Top