macro v's function

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
 
T

Tom van Stiphout

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
 

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