macro v's function

  • Thread starter Thread starter Tanya
  • Start date Start date
T

Tanya

Hi,
I have a line of code that am using on several forms:

DoCmd.Close
DoCmd.OpenForm "Data", acNormal, , , , acDialog

and wondering if I should set up a module with and call the function instead
OR alternatively set up a macro for each instance.

Could someone please advise me on the best approach?

Kind regards
Tanya
 
On Wed, 3 Dec 2008 02:45:01 -0800, Tanya

Well, you could create a Public Function in a standard module (say:
CloseFormAndOpenAnother), pass in the name of the next form, and call
that. You then would have replaced two lines by one. Not a great
savings. Plus it wouldn't work if in some cases you would not want to
close the first form, or if you wanted to open the second form in
normal mode rather than dialog, or if you wanted to pass in OpenArgs
into the second form, or if you wanted to use the where-clause
argument, etc.
In short, I don't think it's worth it.

-Tom.
Microsoft Access MVP
 
Back
Top