views:

212

answers:

1

So I am in Excel trying to read the last saved metadata from an Access database, but I cannot figure out how on earth to do this.

If I use environ$("username") it will give my the last saved information for the excel document where I am coding, not the access db that I want it to grab from. Excel has a built in function for grabbing username data, but I cannot find one for access.

How can I do this?! Any help is greatly appreciated!

A: 

From the Access 2003 menu, File -> Database Properties brings up a tabbed dialog which includes a Statistics tab with a line labelled "Last saved by:". However, I checked several of my databases, and none of them have an entry after that label. The dialog does not allow me to type in anything either. And I can't find any programmable method to set or retrieve a value for last saved by. I couldn't turn up any additional information from web searches.

Perhaps that property is unused. I don't know.

I'm also curious what it would mean for an Access database. At first blush, I would think it should mean the last user to insert, update, or delete table data. However the disk file can be updated for any of a number of other reasons: changes to forms or reports; adding or dropping an index; even simply running Compact & Repair without changing any data.

I think you would have to design your own provision to keep track of which user last modified table data. Allen Browne has an article, Creating an Audit Log, which might help you do the tracking you want.

HansUp
Office document properties are available using a DLL, the DSO OLE document reader (http://support.microsoft.com/kb/224351). The problem is that it doesn't read Access file properties! I don't know what they were thinking when they designed it that way. Those properties might be available through one of the document collections of the top-level database container, but since it's not updated, it won't do anything useful.
David-W-Fenton
@David I also looked at file properties in Windows Explorer. For an XLS, it reported all sorts of stuff. But for an MDB, the information was much skimpier. I think that's consistent with what you're saying. Thanks again.
HansUp
That Dsofile link was interesting. But it doesn't even mention Access in the "applies to". Sometimes it seems like Access is the ugly stepchild of the Office family. :-)
HansUp
It's a real pain because I used it in my port of the FileSearch object to an Access class module (http://dfenton.com/DFA/download/Access/FileSearch.html) and discovered this oversight when trying to search for Access files with properties set in that dialog. I don't know if the original FileSearch object can find Access properties or not -- I don't care so much about it, but if I really wanted to replicate its functionality as completely as possible, I'd have to figure it out. Given the problems I'm having with it in Win7, I'm not sure the effort is worth it!
David-W-Fenton