Display File Name of backend mdb - how?

CutAndPaste

Registered User.
Local time
Today, 09:07
Joined
Jul 16, 2001
Messages
60
Quite often I'll make a "training" version of the backend database so that people can "play" (or should I say get training) on dummy data without them having to worry about ruining the live data.

If my real data is in a file called RealData.mdb and my dummy data is in a file called TrainingData.mdb, I want to display this name prominently on my menu form. Thus they can then change the link on the front end to the real or dummy data as required BUT have a reminder as to which they're on.

How can I do this? Further rather than using the file name, could I use one of the database properties (say Title) to display a more friendly text name?

thanks,

Simon
 
there is a way to use code to extract the file name, but i can't remember what it is off the top of my head....the other way, as you asked, is to change the properties of the database to say whatever you want...click on Tools>Startup and you can change the name, which form to open, icons, etc, etc...that's the way i've always done it...very easy and highly customizable...
 
Ok, found this:

Code:
currentdb.TableDefs("tblOneOfMmyLinkedTablesName").Connect

returns something like this => ;DATABASE=X:\FolderPath\XXX-data.mdb

BUT:

To get this looking neater..

How can I strip out all of the detail except the mdb name?
OR
How do I display any of the database properties of the linked database?
 
Run this SQL to list all of the LINKED tables and their location...

Code:
SELECT MSysObjects.Name, MSysObjects.Database
FROM MSysObjects
WHERE (((Left([Name],1))<>"~") AND ((MSysObjects.Type)=4 Or (MSysObjects.Type)=6))
ORDER BY MSysObjects.Name;

Searching the forum is a great way to answer many of your questions. Stuff like this is posted in quite a few threads. Getting location of linked tables database
 
To answer your question on how to parse out the file name from a full path [string]...

Code:
Public Function ParseFileName(sFile As String) As String
On Error GoTo Err_ParseFileName

    Dim sPath As String
    
    sPath = sFile
    
    Do While Right$(sPath, 1) <> "\"
    sPath = Left$(sPath, Len(sPath) - 1)
    Loop
    
    ParseFileName = Mid$(sFile, Len(sPath) + 1)
 
Exit_ParseFileName:
    Exit Function

Err_ParseFileName:
    MsgBox Err.Number & " -" & Err.Description
    Resume Exit_ParseFileName
 
End Function
getting file names in a given directory and then storing them in an array
 

Users who are viewing this thread

Back
Top Bottom