|
-
May 6th, 2002, 11:14 AM
#1
Thread Starter
Addicted Member
Database Name
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?
Catholics Do It With Beads
-
May 6th, 2002, 11:17 AM
#2
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
-
May 6th, 2002, 11:19 AM
#3
Thread Starter
Addicted Member
Thank you Mr. Hack, but I'm wanting the name to be in a messagebox, but in a text box.
Catholics Do It With Beads
-
May 6th, 2002, 11:23 AM
#4
Ok. I just used Msgbox as an example. You can display it in anything you wish.
-
May 6th, 2002, 11:24 AM
#5
Thread Starter
Addicted Member
How to do this for textbox?
Catholics Do It With Beads
-
May 6th, 2002, 11:42 AM
#6
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|