Calling a Module

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

OK, this should be an easy one for all of you but I have
never tried this. How can I create a Module to close a
report and then open a specific form?

I have around 30 reports and I would rather create one
Module and call it on the "close" function for each report
instead of writing:

DoCmd.OpenForm "frm...."
DoCmd.Maximize

I know its not much coding but when you do it over 30
times, it becomes time consuming. Thanks in Advance!
 
Rick said:
OK, this should be an easy one for all of you but I have
never tried this. How can I create a Module to close a
report and then open a specific form?

I have around 30 reports and I would rather create one
Module and call it on the "close" function for each report
instead of writing:

DoCmd.OpenForm "frm...."
DoCmd.Maximize

I know its not much coding but when you do it over 30
times, it becomes time consuming. Thanks in Advance!

Create it as a public function in a standard module (i.e., not a form or
report module). It could look like this:

Public Function OpenMainForm()

DoCmd.OpenForm "frm..."
DoCmd.Maximize

End Function


You'd probably want to change the function name to something more
appropriate, but assume we've called it "OpenMainForm". Now you can set
the OnClose property of each of those reports, not to "[Event
Procedure]", but to

=OpenMainForm()

That's all.
 
Dirk,

Thanks for the assistance. This NewsGroup has helped me
significantly in my programming and database creation
abilities!
-----Original Message-----
OK, this should be an easy one for all of you but I have
never tried this. How can I create a Module to close a
report and then open a specific form?

I have around 30 reports and I would rather create one
Module and call it on the "close" function for each report
instead of writing:

DoCmd.OpenForm "frm...."
DoCmd.Maximize

I know its not much coding but when you do it over 30
times, it becomes time consuming. Thanks in Advance!

Create it as a public function in a standard module (i.e., not a form or
report module). It could look like this:

Public Function OpenMainForm()

DoCmd.OpenForm "frm..."
DoCmd.Maximize

End Function


You'd probably want to change the function name to something more
appropriate, but assume we've called it "OpenMainForm". Now you can set
the OnClose property of each of those reports, not to "[Event
Procedure]", but to

=OpenMainForm()

That's all.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top