Calling a Module

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!
 
D

Dirk Goldgar

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.
 
R

Rick

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)


.
 

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

Top