|
|
Call Public Sub in a SubForm
I have a Master Form with multiple subforms. I want to call a Public (I
changed it from Private to Public) subroutine from a different Subform which
is part of the same Master form. It doesn't work.
Here is my call:
Forms!frmMaster!frmChecks.Post_Check
I am calling Public Sub Post_Check() from a subroutine in
Forms!frmMaster!frmPost
The Message is:
RunTime Error '438'
Object doesn't support this Property or Method
What am I missing?
Many Thanks
Ross
|
|
0
|
|
|
|
Reply
|
Utf
|
7/24/2007 7:52:07 PM |
|
Ross,
I generally find that if I want to call code that is in a forms code module,
from another form, that it really belongs in a code module, rather than in
the forms code module.
This can cause some challenges, because you can no longer refer to the form
as Me, but this is relatively easy to overcome by passing the form or the
form name to the code module.
HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.
"Ross" wrote:
> I have a Master Form with multiple subforms. I want to call a Public (I
> changed it from Private to Public) subroutine from a different Subform which
> is part of the same Master form. It doesn't work.
>
> Here is my call:
> Forms!frmMaster!frmChecks.Post_Check
>
> I am calling Public Sub Post_Check() from a subroutine in
> Forms!frmMaster!frmPost
>
> The Message is:
> RunTime Error '438'
> Object doesn't support this Property or Method
>
> What am I missing?
>
> Many Thanks
>
> Ross
>
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
7/24/2007 8:10:03 PM
|
|
Dale,
I agree. I did this subform business as a "afterthought" (after devloping
the individual forms). I can transfer all the code to a class module, but
was hoping that I didn't have to do this.
Thank You!
"Dale Fye" wrote:
> Ross,
>
> I generally find that if I want to call code that is in a forms code module,
> from another form, that it really belongs in a code module, rather than in
> the forms code module.
>
> This can cause some challenges, because you can no longer refer to the form
> as Me, but this is relatively easy to overcome by passing the form or the
> form name to the code module.
>
> HTH
> Dale
> --
> Email address is not valid.
> Please reply to newsgroup only.
>
>
> "Ross" wrote:
>
> > I have a Master Form with multiple subforms. I want to call a Public (I
> > changed it from Private to Public) subroutine from a different Subform which
> > is part of the same Master form. It doesn't work.
> >
> > Here is my call:
> > Forms!frmMaster!frmChecks.Post_Check
> >
> > I am calling Public Sub Post_Check() from a subroutine in
> > Forms!frmMaster!frmPost
> >
> > The Message is:
> > RunTime Error '438'
> > Object doesn't support this Property or Method
> >
> > What am I missing?
> >
> > Many Thanks
> >
> > Ross
> >
> >
> >
|
|
0
|
|
|
|
Reply
|
Utf
|
7/24/2007 8:20:02 PM
|
|
Dale did not say Class module.
There is a big difference between a Standard "Code" module and a Class
module. A standard module is a collection of mostly Public subs and functions
that can be called from any where in the application. They will sometimes
contain Private procedures if the private procedures are used only by other
procedures in the same module.
A Class module is a very different thing. Class modules are a special kind
of module that has methods and properties. You create an instance of a Class
with a name, then use the properties an methods.
--
Dave Hargis, Microsoft Access MVP
"Ross" wrote:
> Dale,
>
> I agree. I did this subform business as a "afterthought" (after devloping
> the individual forms). I can transfer all the code to a class module, but
> was hoping that I didn't have to do this.
>
> Thank You!
>
> "Dale Fye" wrote:
>
> > Ross,
> >
> > I generally find that if I want to call code that is in a forms code module,
> > from another form, that it really belongs in a code module, rather than in
> > the forms code module.
> >
> > This can cause some challenges, because you can no longer refer to the form
> > as Me, but this is relatively easy to overcome by passing the form or the
> > form name to the code module.
> >
> > HTH
> > Dale
> > --
> > Email address is not valid.
> > Please reply to newsgroup only.
> >
> >
> > "Ross" wrote:
> >
> > > I have a Master Form with multiple subforms. I want to call a Public (I
> > > changed it from Private to Public) subroutine from a different Subform which
> > > is part of the same Master form. It doesn't work.
> > >
> > > Here is my call:
> > > Forms!frmMaster!frmChecks.Post_Check
> > >
> > > I am calling Public Sub Post_Check() from a subroutine in
> > > Forms!frmMaster!frmPost
> > >
> > > The Message is:
> > > RunTime Error '438'
> > > Object doesn't support this Property or Method
> > >
> > > What am I missing?
> > >
> > > Many Thanks
> > >
> > > Ross
> > >
> > >
> > >
|
|
0
|
|
|
|
Reply
|
Utf
|
7/24/2007 8:50:05 PM
|
|
"Ross" <Ross@discussions.microsoft.com> wrote in message
<D6AFE939-A9EE-4AC8-B27A-195391C34443@microsoft.com>:
> I have a Master Form with multiple subforms. I want to call a Public
> (I changed it from Private to Public) subroutine from a different
> Subform which is part of the same Master form. It doesn't work.
>
> Here is my call:
> Forms!frmMaster!frmChecks.Post_Check
>
> I am calling Public Sub Post_Check() from a subroutine in
> Forms!frmMaster!frmPost
>
> The Message is:
> RunTime Error '438'
> Object doesn't support this Property or Method
>
> What am I missing?
>
> Many Thanks
>
> Ross
Quite possibly the Form keyword
Forms!frmMaster!frmChecks.Form.Post_Check
--
Roy-Vidar
|
|
0
|
|
|
|
Reply
|
RoyVidar
|
7/24/2007 9:16:13 PM
|
|
And if not that, try adding 'Call':
Call Forms!frmMaster!frmChecks.Form.Post_Check
HTH,
"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.c5747d772b073292.59509@yahoo.no...
> "Ross" <Ross@discussions.microsoft.com> wrote in message
> <D6AFE939-A9EE-4AC8-B27A-195391C34443@microsoft.com>:
>> I have a Master Form with multiple subforms. I want to call a Public
>> (I changed it from Private to Public) subroutine from a different
>> Subform which is part of the same Master form. It doesn't work.
>>
>> Here is my call:
>> Forms!frmMaster!frmChecks.Post_Check
>>
>> I am calling Public Sub Post_Check() from a subroutine in
>> Forms!frmMaster!frmPost
>>
>> The Message is:
>> RunTime Error '438'
>> Object doesn't support this Property or Method
>>
>> What am I missing?
>>
>> Many Thanks
>>
>> Ross
>
> Quite possibly the Form keyword
>
> Forms!frmMaster!frmChecks.Form.Post_Check
>
> --
> Roy-Vidar
>
>
|
|
0
|
|
|
|
Reply
|
George
|
7/25/2007 4:00:55 PM
|
|
|
5 Replies
603 Views
(page loaded in 0.096 seconds)
|
|
|
|
|
|
|
|
|