Loading settings from external file

B

BloodBaz

Hi,
I have an Access application which performs a lot of file manipulation on a
netword drive.

I would like to remove hard coded root paths and place them in an external
file that can be loaded in when the Access application is launched. That
way, we can provide a robust method to "point" the applciation to another
folder strucutre for testing and development.

I was thinking of a txt file in the same folder as the mdb file which would
contain a few config variables. Once "read" in, they could be held in global
vars for access throughout the app.

Is this a sensible route? and which vba functions should I use to go about
such a job? (can't find any similar question on the forum)

Thanks in advance.
BloodBaz
 
B

BloodBaz

PS: Coming from an .NET / SQL Server background, I am looking for the
equivilent of web.config settings but for MS Access 2003+
 
B

BloodBaz

Thanks Alex and Daniel for the tips.
I can set "defaults" (if registry settings are omitted) to the production
server.

Dev environments can then be modified by developers as a one-off.

Cheers.
 
B

BloodBaz

Excellent. That has worked.

The second half is now to read one and "access" throughout the Access
application.
I can encapsulate the "read config" and "use default" code into a Class
Module (called AppConfig) which I will instantiate on the Form1_Load() event.

Is ther any way to make the Class Module "global"? I don't want differnet
forms/modules/functions having to reinstantiate the class (and read the
registry) everytime I with to get a config value.

I've found the Static keyword but this only stops reinitialisation of a
variable between function calls. In C# I would create a "static class" but I
can't seem to do this in VBA. Any suggestions?

Thanks again.
 

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