Database file properties

sarah_anne

Registered User.
Local time
Today, 12:07
Joined
Jul 29, 2005
Messages
17
I've been searching for a way to access when my .mdb file was last modified (going to put it in a label on my startup form), and came across this: http://www.access-programmers.co.uk/forums/showthread.php?t=72721&highlight=file+modified

In that thread, FileDateTime is used:

MsgBox FileDateTime("Y:\i-spectra\working\dev\vc\db\VesselConfiguration.mdb")

... would therefore be for mine. And it works great.

However, my .mdb file will move around with various people, and one day it'll be on one drive letter, another day it'll be on another drive, which makes it impossible to specify the exact location of the file. They also might rename it to something else sometimes!

I thought MsgBox FileDateTime("VesselConfiguration.mdb") might work, but it doesn't.

1) is there any way of using FileDateTime without specifying a path to the file?

2) how do i get the name of the current file then also?

Ideally, my statement would look like:

MsgBox FileDateTime("[filename]")
... i.e. not giving a path OR a hard-coded filename.

How can this be done, please? :confused: :) :o
 
so, you want to access a file and have access just 'know' the file you want to open? im afraid that this is impossible still. However, what you can do is when you open up the form, you ask for the file that you wish to have opened, so they say where it is, and then you store this in a variable for use throughout the form.

Oh and just so you know, you always need to specify the path, if you have just the filename, this just means that it looks for the file in the current directory(not searching the whole system).

There are no ways around this, as the path and filename is the only way windows has for knowing which file you mean(at least until we get brain scanners so that you can just think about a file and the computer loads it for you)
 
Last edited:
lol no, I mean the file I want to know the file properties for IS the file opened in MS Access!

I.e. config.mdb has a form in it. When opened, I need to display when the last time config.mdb was modified.

I can do this using FileDateTime, BUT only if I know both what the user has called the database file and where it resides on their system, things which I cannot begin to guess.

Hope I've clarified! :)
 
heh, sorry :) hmm... that sounds more possible. not sure how to do it though :( am currently googling to see if i can find anything
 
:D I figured it'd be a breeze just to use

MsgBox FileDateTime("VesselConfiguration.mdb")

... obviously not that simple. I've done a search (several) here, on google, on other Access forums I've found... nothing... even MDSN no help! This can't be an odd thing to want to do -- when distributing a database file how can the developer know where the user will put it, etc... so I refuse to give up yet!

p.s. those brain scanners sound like a fab idea - pm me when they're out commercially, eh? ;)
 
sarah_anne said:
This can't be an odd thing to want to do -- when distributing a database file how can the developer know where the user will put it, etc

Well, most developers would set up an install program that stores the paths in a config file, and then tell the user to never ever touch these files as doing so will break their computer.

sarah_anne said:
p.s. those brain scanners sound like a fab idea - pm me when they're out commercially, eh? ;)

They have some experimental ones. With an hour of it learning your brain, it can (just about) move a mouse around the screen, so not too far off :)
 
If I understand correctly Currentdb.name should give you the path and filename of your currently open db.

Try

MsgBox FileDateTime(Currentdb.Name)

Richard
 
richary, it seems to be working, thank you! :) :D

Right, off to fix a problem with my access forms and then read up on these brain scanners before lunch, should make for interesting reading, eh? :)
 

Users who are viewing this thread

Back
Top Bottom