Run code on a different form

  • Thread starter Thread starter David
  • Start date Start date
D

David

Is it possible to run code on a different open form from the current form
you have open? For example, I want to run the After_Update code in a
control on an open but not active form. Thanks.

David
 
Why not put the code in a module, and call it from both places?
 
I can do that, but I thought I read somewhere that you can run a form module
from another open form. I just want to know how to do that. The module
thing is easy, but this situation requires very different controls and
forms. Thanks.

David
 
I don't understand how it could require different controls and forms if you
intend to call it from somewhere else!

To call the code for the After_Update event of another form, you'd need to
change the declaration of the sub from Private to Public. You'd then call it
as:

Call Form_FormWithFunction.Form_AfterUpdate

(replace FormWithFunction with the appropriate name)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top