I have a database, and I know where it is, but when I display all I want is database name, not path.
How is this done?
Printable View
I have a database, and I know where it is, but when I display all I want is database name, not path.
How is this done?
VB Code:
Private Sub cmdGetDBName_Click() Dim aryDBName() As String Dim sDBPathAndName As String Dim sDBName As String sDBPathAndName = Text1.Text 'Create the array with the \ as the delimiter aryDBName = Split(sDBPathAndName, Chr$(92)) 'Now we have a one-dimensional zero-based array with the 'drive, folder names and db name as the elements 'the db name will always be the last element sDBName = UBound(aryDBName) MsgBox aryDBName(sDBName) End Sub
Thank you Mr. Hack, but I'm wanting the name to be in a messagebox, but in a text box.
Ok. I just used Msgbox as an example. You can display it in anything you wish. :confused:
How to do this for textbox?
Sigh...VB Code:
Private Sub cmdGetDBName_Click() Dim aryDBName() As String Dim sDBPathAndName As String Dim sDBName As String sDBPathAndName = Text1.Text 'Create the array with the \ as the delimiter aryDBName = Split(sDBPathAndName, Chr$(92)) 'Now we have a one-dimensional zero-based array with the 'drive, folder names and db name as the elements 'the db name will always be the last element sDBName = UBound(aryDBName) Text2.Text = aryDBName(sDBName) End Sub