calling sub on subform

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

Guest

I am trying to call a sub from a form. The sub I want to call is called
restore and it is in the subform rgaParts. I have tried many variations to
call it and nothing is working. The sub is declared as public. I am using
Access 2000.
 
Hi, if your calling the procedure from the parent form then use statement

Me.rgaParts.Form.restore

where "rgaParts" is the name of the subform control

HTH, Graeme.
 
Here is a partial list of different variations I have tried. The parent is
frmRGA and the child subform is frmRGAParts. I am stumped. I don't know why
it will not work. Thanks for any help.
Forms!Form_frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms_frmRGA.frmRGAParts.Form.restore
Forms![frmRGA]![frmRGAParts].Form.restore
Form_frmRGA.frmRGAParts.Form.restore
Form_frmRGAParts.restore
Me!frmRGAParts.Form.restore
Forms!frmRGA.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms!frmRGA!frmRGAParts.Form.restore
Call Me.frmRGAParts.Form.restore
Me.frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Call Form_frmRGAParts.restore
Forms!frmRGA!frmRGAParts.Form.restore
Me!frmRGAParts.Form.restore
Call Me(frmRGAParts).Form.restore
 
If you move the sub into a standard module, you can call it from any code in
your application using nothing but the name of the sub.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


JasonT said:
Here is a partial list of different variations I have tried. The parent
is
frmRGA and the child subform is frmRGAParts. I am stumped. I don't know
why
it will not work. Thanks for any help.
Forms!Form_frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms_frmRGA.frmRGAParts.Form.restore
Forms![frmRGA]![frmRGAParts].Form.restore
Form_frmRGA.frmRGAParts.Form.restore
Form_frmRGAParts.restore
Me!frmRGAParts.Form.restore
Forms!frmRGA.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms!frmRGA!frmRGAParts.Form.restore
Call Me.frmRGAParts.Form.restore
Me.frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Call Form_frmRGAParts.restore
Forms!frmRGA!frmRGAParts.Form.restore
Me!frmRGAParts.Form.restore
Call Me(frmRGAParts).Form.restore

Graeme Richardson said:
Hi, if your calling the procedure from the parent form then use statement

Me.rgaParts.Form.restore

where "rgaParts" is the name of the subform control

HTH, Graeme.
 
The sub is a improvised Undo action. The form saves the values in the fields
when it is opened and when they click undo it will call the sub to replace
the values.

Brendan Reynolds said:
If you move the sub into a standard module, you can call it from any code in
your application using nothing but the name of the sub.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


JasonT said:
Here is a partial list of different variations I have tried. The parent
is
frmRGA and the child subform is frmRGAParts. I am stumped. I don't know
why
it will not work. Thanks for any help.
Forms!Form_frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms_frmRGA.frmRGAParts.Form.restore
Forms![frmRGA]![frmRGAParts].Form.restore
Form_frmRGA.frmRGAParts.Form.restore
Form_frmRGAParts.restore
Me!frmRGAParts.Form.restore
Forms!frmRGA.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Forms!frmRGA!frmRGAParts.Form.restore
Call Me.frmRGAParts.Form.restore
Me.frmRGAParts.Form.restore
Forms!frmRGA![frmRGAParts].Form.restore
Call Form_frmRGAParts.restore
Forms!frmRGA!frmRGAParts.Form.restore
Me!frmRGAParts.Form.restore
Call Me(frmRGAParts).Form.restore

Graeme Richardson said:
Hi, if your calling the procedure from the parent form then use statement

Me.rgaParts.Form.restore

where "rgaParts" is the name of the subform control

HTH, Graeme.
 
Just a thought, but is there data in the subform when you call the sub?
Also, is an error message displayed when the the sub is not found?

Graeme.
 
There is data on the subform and the error message is
Object doen't support this property or method.
Is there some rule to follow about whether you create the form and then use
it as the subform or if you let the subform wizard create it? I am
refrencing the text boxes in the subform but not the sub.
 
Place the line

MsgBox "In"

as the first statement in the restore Sub, and

MsgBox "Out"

as the last. This will indicate if the sub is called and potentially if
error is raised by statements in the sub. (Having said this, are there
statements executed before the restore call that may be causing the error?)

Otherwise, please supply:
the name of the parent form, the name of the subform control (on the parent
form), the name of the subform, and the statement that your using to call
the sub.

What happens when you pace a command button on the parent form and call the
sub from the click event?

Graeme.
 
Back
Top