[AccessD] Read External File for Path String

Gustav Brock Gustav at cactus.dk
Fri Jan 20 07:02:49 CST 2006


Hi Stuart

Well, sometimes yes. That depends. 

We have several apps where we store user settings like window size and position and other preferences. Right now we use an INI file but it could as well be an XML file.
The data are written just before the app closes and read back when it opens.
The advantage is that we can update the app (the frontend) without losing the user's preferences. I think this is important and a quite common scenario.

We could use the registry. There really is no reason to be afraid of that as some are (just use a scanner and watch how many data are read/written to the registry while using a standard app like Word, you hardly believe it) but it has some limitations as mentioned by Charlotte.
Using an external file like an XML file allows you to easily copy standard settings or settings from a similar user to a new user's machine after installation of the app.
Further, XML files have the advantage that they are easier to maintain from external sources and very high quality tools exist for the purpose; INI files are mostly modified by a simple editor.

/gustav

>>> stuart at lexacorp.com.pg 20-01-2006 13:30 >>>
On 20 Jan 2006 at 12:47, Gustav Brock wrote:

> Hi Stuart
> 
> Use A2002+.
> Have an internal table with your path, tblPath.
> 
> To export:
> Application.ExportXML acExportTable , "tblPath", "c:\mypath.xml"
> 
> To import:
> CurrentDb.Execute "Delete * From tblPath"
> Application.ImportXML "c:\mypath.xml", acAppendData
> 
> To read:
> strPath = DLookup("Path", "tblPath")
> 
> Not quite sure how "easy" that is, though in total only four code lines net
> are needed. However, if you need to store a bunch of user or app settings it
> might be a nice method with all the advantages of XML storage and exchange
> possibilities.
> 

You generally don't need to exchange user/app settings between 
applications.

If you have to store you settings in a table in the database to use an XML 
file, why bother? You can just read/write to the table itself.


 -- 
Stuart





More information about the AccessD mailing list