Calling a Sub-routine in a Private Module

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

Guest

I am trying to Call / Run a "public" sub routine that resides in a private
module (a form which is open but does not have the focus) from a public Sub
in a Class module.

How can I reference to run this Subroutine (which update the totals in this
form)?

Thanks

Ross
 
Ross said:
I am trying to Call / Run a "public" sub routine that resides in a
private module (a form which is open but does not have the focus)
from a public Sub in a Class module.

How can I reference to run this Subroutine (which update the totals
in this form)?

You need to prefix the procedure name with a reference to the form
object that contains it. It would look something like this:

Forms!YourFormName.UpdateTotals
 
Ross said:
I am trying to Call / Run a "public" sub routine that resides in a private
module (a form which is open but does not have the focus) from a public Sub
in a Class module.

How can I reference to run this Subroutine (which update the totals in this
form)?


PUBLIC procedures in a form's module are methods of the
form's class module, so the reference would be:

for Sub procedures:
fobj.procedurename arglist
or, for a Function procedure:
x = fobj.procedurename(arglist)
where fobj is the form object (usually written as
Forms!formname)
 
Marshall,

Thank you!

Ross

Marshall Barton said:
PUBLIC procedures in a form's module are methods of the
form's class module, so the reference would be:

for Sub procedures:
fobj.procedurename arglist
or, for a Function procedure:
x = fobj.procedurename(arglist)
where fobj is the form object (usually written as
Forms!formname)
 
Dirk

Thank you!


Ross

Dirk Goldgar said:
You need to prefix the procedure name with a reference to the form
object that contains it. It would look something like this:

Forms!YourFormName.UpdateTotals

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

(please reply to the newsgroup)
 
Back
Top