How to import or link LOG text files into MS Access databases?
OR: How to force MS Access to work with text files having different extensions?
In MS Access, If you try to import or link a text file not having one of the following extensions: txt, csv, asc or htm
Ms Access displays an error message:
You can only import files having txt,csv,asc,htm,html extension
To examine in a more accurate method the server’s LOG files, my project required to import and/or link text files having the LOG extension.
Something the MS Access refused to do... A solution had thus to be found.
There are several solutions:
The first, of course, is to rename the files to one of the accepted extensions!
Another more persistent solution:
Open the registry;
Go the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text
Modify the entry (SZ) named DisabledExtensions (originally having the text value "!txt, csv, asc,htm,html”
Add to this entry the desired extension.
Example, if you wish to add the extension log, give the entry the following value "!txt, csv,asc,htm,html,log"
Some more comfort!
When MS Access displays the Open File dialog box for selecting the text file, only files having the basic extensions are displayed.
To force displaying your desired extension:
Add the extension to another entry named Extensions in this same key.
Locking table information
It is sometimes necessary to prohibit the deletion of some data in a table.
When I worked on a demo for easySite.NET, it was necessary to publish some articles, allowing users to modify article’s texts without allowing the articles deletion... here is the solution I found.
The table articles contained already a field id (unique article identifier)
I created a table lock_articles... having only one field article_id which refered the field id of the articles table.
To enable unique article insertion in lock_articles table, The relation between articles and lock_articles is 1 to 1
We insert in lock_articles table all IDs of the articles that we don’t want to be deleted.
Now, prior to deleting any item in the articles table, it is necessary to delete its reference in the lock_articles table, which is accessible only to database administrator.