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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modules calling form functions 2

Status
Not open for further replies.

vasah20

Programmer
Feb 16, 2001
559
US
How can I access a Sub inside Form1 from Module1?

Is this even possible?

What I want to do is have a 'progress bar' embedded into the form... I'm going to use labels to simulate the progress bar, but all the heavy duty processing happens in the module. I'd like to be able to update the labels from the module.

Something like
(( from inside module ))
Form1.setPBMax(maxCount)

While ...
...
Form1.incrementPB()
Wend

Is what I envision. Suggestions?

TIA-
leo

 
Hi!

The syntax for this is:

Call Forms.Form1.setPBMax(maxCount)

Two conditions apply: Form1 must be open and setPBMax must be declared using the Public keyword.

hth
Jeff Bridgham
bridgham@purdue.edu
 
As with any other "global" type....to access a sub or function in a form class module, you simply need to define the sub or function as Public instead of Dim.... Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III, MCP, Network+, A+
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
but overall, it is a poor approach. The Module (actually PROCEDURE(s) are then dependent on the form being available. Since the moules procedure(s) are (presumably) called from a form, you can improve the process substantially by making the form and control(s) optional arguments in the procedure call(s). Then, the procedure(s) can at least CHECK that the form is open and take the appropiate action if it is NOT. Further, the procedure caould be used with any form / control(s) ...

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top