From: Deanna on
I have two seperate forms (frmA, frmB). I have a command button on frmA that
when clicked should click a command button on frmB. I am using a Call to do
this but keep getting a message: application-defined or object-defined error.
I have tweaked my code to match other Q&A solutions here but I still can't
get this to work. Any thoughts?

Call Forms("frmB").Command229_Click
From: Dirk Goldgar on
"Deanna" <Deanna(a)discussions.microsoft.com> wrote in message
news:4F49ABBA-69A2-4E84-9AA7-D9B2D04E64D2(a)microsoft.com...
>I have two seperate forms (frmA, frmB). I have a command button on frmA
>that
> when clicked should click a command button on frmB. I am using a Call to
> do
> this but keep getting a message: application-defined or object-defined
> error.
> I have tweaked my code to match other Q&A solutions here but I still can't
> get this to work. Any thoughts?
>
> Call Forms("frmB").Command229_Click


1. You need to make sure that Comand229_Click is defined in frmB as a Public
Sub, not Private.

2. frmB must be open when you call the Sub.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: Deanna on
Dirk,
As you suspected Command229_Click is Private sub. What are the steps needed
to change this to Public and are there (I'm assuming yes) ramifications to
doing this?
Deanna

"Dirk Goldgar" wrote:

> "Deanna" <Deanna(a)discussions.microsoft.com> wrote in message
> news:4F49ABBA-69A2-4E84-9AA7-D9B2D04E64D2(a)microsoft.com...
> >I have two seperate forms (frmA, frmB). I have a command button on frmA
> >that
> > when clicked should click a command button on frmB. I am using a Call to
> > do
> > this but keep getting a message: application-defined or object-defined
> > error.
> > I have tweaked my code to match other Q&A solutions here but I still can't
> > get this to work. Any thoughts?
> >
> > Call Forms("frmB").Command229_Click
>
>
> 1. You need to make sure that Comand229_Click is defined in frmB as a Public
> Sub, not Private.
>
> 2. frmB must be open when you call the Sub.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>
From: Dirk Goldgar on
"Deanna" <Deanna(a)discussions.microsoft.com> wrote in message
news:946E4A9F-33C3-476E-A863-6235AEFA35A0(a)microsoft.com...
> Dirk,
> As you suspected Command229_Click is Private sub. What are the steps
> needed
> to change this to Public and are there (I'm assuming yes) ramifications to
> doing this?

No ramifications. Just open the form in design view, go to the form's
module and change the line:

Private Sub Command229_Click()

to:

Public Sub Command229_Click()

Recompile and save.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)