change application title (1 Viewer)

qwertyjjj

Registered User.
Local time
Yesterday, 21:49
Joined
Aug 8, 2006
Messages
262
I would like to change the Application Title to the filename of the Access DB when a form is loaded.
Users actually change the Access DB filename every now and then with a month value to show its latest update and would like this to appear at the top.

Any ideas?
I have a dummy title set as part of the Startup properties.
 

qwertyjjj

Registered User.
Local time
Yesterday, 21:49
Joined
Aug 8, 2006
Messages
262
Thanks.
Also, need to find how to get the filename.
Is this contained in a property somewhere?
 

jwhite

Software Developer
Local time
Today, 00:49
Joined
Sep 24, 2006
Messages
141
Hope this helps. This function is a "dual-purpose" design. You can call it to parse any filepath.

Code:
Option Compare Database
Option Explicit

Function RemovePath(Optional filepath As String)
    '
    'INPUT  : filepath to parse
    '         OPTIONAL - If not passed, default to filepath of CurrentDB
    'RETURNS: filename from the filepath
    '
    'CALLS  : Parse an existing filepath value:
    '           strfilename = RemovePath("c:\data\mystuff.txt")
    '       : Get the filename of the Current Database that is open:
    '           strDBFileName = RemovePath
    '
    'To display the DB Name an existing TextBox, put this in the
    'ControlSource of the textbox: =RemovePath()
    '
    Dim x As Integer
    Dim Y As Integer
    
    If Nz(filepath, "") = "" Then filepath = CurrentDb.Name
    
    x = 0: Y = 0
    Do: x = Y + 1: Y = InStr(x, filepath$, "\"): Loop Until Y = 0
    RemovePath = Mid(filepath, x)
    'Debug.Print "FullPath: "; filepath
    'Debug.Print "FileName: "; RemovePath
    x = 0: Y = 0
End Function
 

Users who are viewing this thread

Top Bottom