Reuse code?

Gasman

Enthusiastic Amateur
Local time
Today, 12:06
Joined
Sep 21, 2011
Messages
17,497
Hi everyone,

I am slowly realising that a piece of code that I wrote for one database could be used in another. One example is an email subroutine, in which I pass the email addresses, file to attach (if required), subject and body text.

Nothing fancy, but I can see that I could use this routine in a small database I am attempting for employee information.

What is the best way to be able to reuse this code?
What would happen if I perhaps 'enhanced' it with the option of multiple filenames split by ';' perhaps?, how would I get that amendment into wherever it was being used.?

TIA
 
Thank you Uncle Gizmo,
Could you please tell me what you use for saving the website. That might be something I could use also.
At present I am just feeling my way, but can see plenty of ways I could improve.
 
Not in Lloyds you wouldn't, they had locked down the DVD drive and I seem to recall USB sticks as well.
I worked for the NHS once and they could not get me the laptop in time, so I offered to bring in my own.
'You won't be able to connect it to our network' was the response
'No problem' was my reply, but I can set up the mailmerges on my laptop.

So I flitted to and fro with a memory stick copying files. :)

I wear a USB dog tag with any medical problems on it, given by the Bikesafe course, when out on my motorbike. If I ever came off, I doubt the ambulance crew would be allowed these days to plug it in to see my medical history. I still wear it though. :)
 
Not having seen the videos, I can tell you that I often make standard code modules with useful functions, such as exporting recordset contents to MS Excel, logging run-time errors, performing file I/O operations, making Windows API calls, etc and importing copies of these modules into new MS Access files when needed. Having copies of these modules embedded within the MS Access "bundle" means that the database will remain operating as expected without risk of unintended impacts should future changes be made to the master modules.
 
I mostly have two modules, one called 's' and one called 'g'. The s is for specific, and only contains code that is just for that database. The g is for generic, and can be safely used in all of my databases. I also have a module called 'backend' which contains all of the functions I could perform to/with the backend from the front end, this is also generic. This is similar to using a library, by I try very hard to avoid references, so I just import them and risk versioning issues.
 

Users who are viewing this thread

Back
Top Bottom