Results 1 to 3 of 3

Thread: located db and save path..

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Unhappy

    this is somewhat a newbie question...
    i am writting a small app for a client that requires the following..
    when the app starts for the first time
    it should ask the user to give path to the db (using a dialog box)
    when the user finds the database throu dialog boxes
    it should store FULL path into a variable i guess..
    and then i can use that variable to know where db is
    any help would be greatly appreciated

    than am gonna write that to a INI file and i can play around with it from there..

    thanks

    *newbie to this dialog thing, please dont get to technical*

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Cool

    give this a whirl

    add a common dialog control to your first form
    Code:
    Private Sub FindDB()
    Dim dbLocation As String
    
    On Error GoTo Open_Error
    
    With CommonDialog1
        .DialogTitle = "Find database"
        .CancelError = True
        .Flags = cdlOFNFileMustExist
        .InitDir = App.Path
        .Filter = "Microsoft Access Database |*.mdb"
        .ShowOpen
        dbLocation = .FileName
    End With
    
    Exit Sub
    
    Open_Error:
        Select Case Err.Number
            Case 1
                Exit Sub
            Case Else
                MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
        End Select
    
    End Sub
    You might have to change a few things around to fit your program, but that is the basics of it.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    lalal

    'slaps himself HARD'

    worked like a charm
    thanks

    hehe the only thing i coudnt figure out was weather .filename gives full path or just filename
    but now i know

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