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!

Access Functions Best Practice

Status
Not open for further replies.

Aidy680

Technical User
Nov 1, 2006
138
0
0
GB
Hi all,

Interested in gauging members thoughts on Access VBA and Functions?

Best practice to be stored in Modules or behind Forms?

They will work when placed behind the latter, but cant help thinking it's bad practice.

 
If your Function(s) are accessed only by a particular Form, and not by any other Form(s), I would keep it ‘local’ in this Form as Private Function(s). But if you have Function(s) that are accessed from multiple Forms, I would place them in one location as Public Function(s) in a Module.

Have fun.

---- Andy
 
Functions that are not unique to the form should be in a separate module. Most functions I write tend not to be unique. If it is truly form specific then it should stay in the form.
 
My thoughts...

If the function is only for use with the form, then put it on the form. (If you import the form somewhere else you have fewer supporting objects to worry about).

If it is generic and could apply to multiple things, put it in a regular module. (If you use the function somewhere else, deleting the form won't break something else).

Generally though if you are bothering to take the time to break it out, it probabably falls in the second scenario.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top