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

Calling procedure from another procedure

Status
Not open for further replies.

krymat

Technical User
Jul 25, 2000
105
Let's say we have Form1!Form!Text1 I want to be able to call the Text1_AfterUpdate from Form2!Form!Command1. What would be the way to do this?
 

You can call it by including it in the code of the button. You can also use the Call statement.

Call Text1_AfterUpdate

I wonder why you want to do this. There is great potential for problems. Imagine that the user types something in the textbox and then clicks the button. The After_Update event would fire twice, consecutively. Depending on what happens in the After_Update event, you could get undesired results. Terry Broadbent

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
How does it know which Text1_AfterUpdate to call if I call it from a different form?
 

I apologize for not reading more carefully. I don't think it is posssible to reference a module in form1 from form2. Even if it were, I recommend creating a module with a public subroutine. You can then reference that subroutine from the After_Update and Button_Click events and anywhere else you need to call it! Terry Broadbent

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
I have found it possible to communicate between two forms using global variables and functions. You could have one of the controls call a global function setsomething() and another control call readsomething().
You would put these funuctions, or even just variables if that will do the trick, in a new module in the database view(not as code in the form you are creating).

I hope this helps a little.
Lb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top