Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running a private function from another form

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
Is there any way to run a private function from another form?
 
Why not make it a Public Function in a Module if there is a chance the code can be re-used more than once. It would cut down on maintenance... Steve Medvid
"IT Consultant & Web Master"
web page under development...
 
You cannot call a private function from another form (out of scope). You must make the function Public (to be seen by the entire db), even if it is an event. For instance, if you want a button named cmdVerify to be called from another form, first change it to public,

Public Sub cmdVerify_Click()

Then from the other form, the syntax would be:

Forms!FormName.cmdVerify_Click

Or you could call the other form's Open event by first changing it to public and then using:

Forms!FormName.Form_Open(0)

Just remember that some events have arguments, like the cancel argument on the OnOpen event, so you have to pass the argument to the event.

Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top