Results 1 to 6 of 6

Thread: Database Name

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Location
    Rome, Italy
    Posts
    150

    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Sub cmdGetDBName_Click()
    2. Dim aryDBName() As String
    3. Dim sDBPathAndName As String
    4. Dim sDBName As String
    5. sDBPathAndName = Text1.Text
    6.     'Create the array with the \ as the delimiter
    7.     aryDBName = Split(sDBPathAndName, Chr$(92))
    8.     'Now we have a one-dimensional zero-based array with the
    9.     'drive, folder names and db name as the elements
    10.     'the db name will always be the last element
    11. sDBName = UBound(aryDBName)
    12. MsgBox aryDBName(sDBName)
    13. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Location
    Rome, Italy
    Posts
    150
    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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Ok. I just used Msgbox as an example. You can display it in anything you wish.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Location
    Rome, Italy
    Posts
    150
    How to do this for textbox?
    Catholics Do It With Beads

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Sigh...
    VB Code:
    1. Private Sub cmdGetDBName_Click()
    2. Dim aryDBName() As String
    3. Dim sDBPathAndName As String
    4. Dim sDBName As String
    5. sDBPathAndName = Text1.Text
    6.     'Create the array with the \ as the delimiter
    7.     aryDBName = Split(sDBPathAndName, Chr$(92))
    8.     'Now we have a one-dimensional zero-based array with the
    9.     'drive, folder names and db name as the elements
    10.     'the db name will always be the last element
    11. sDBName = UBound(aryDBName)
    12. Text2.Text = aryDBName(sDBName)
    13. 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
  •  



Click Here to Expand Forum to Full Width