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

Need to call a procedure from another model

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
0
0
CA
Hi

From form1's code, I open form2 assigning some of the fields values.

DoCmd.OpenForm "Form2"
Form_Form2.ModelID = Me.ModelID
Form_Form2.PIN_SerialNumber = Me.PIN_SerialNumber


Could I also call one of the Form2 procedures from within the form1's code?

Thanks
 
Your question intrigued me so I opened a form, set a subroutine to 'Public', set a breakpoint on the first executable line of the subroutine, and entered the following in the immediate window.

Call Forms("frmErrorLog").chkClose_AfterUpdate

The result was that processing was trapped on the breakpoint. So, I would give your question a resounding 'Yes'.

To get your form1 to be able to call a form2 procedure, make sure the procedure is 'Public' and enter something like:
Call Forms("Form2").YourPublicProcedure

----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Thanks,

but i just tried this code and unfortunatelly it didn't work. The error message says no macro could be found with this name.
 
A better practice when your want to share code across forms would be to create/use a module and place the code there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top