Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening datbase with only part of the name (Access 2000)

    I have a function beginning with opening a database like that :
    Set dbs = wsp.OpenDatabase("C:BEFrontEndBS.mdb", False, False, ";PWD=" & strPassword)
    I want to use the same function to open other front ends having the same prefix “FrontEnd” but with different endings like : FrontEndSg,FrontEngPl, etc
    In one computer there exists only one FrontEnd, so there is no danger of a conflict.
    How could I do that ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening datbase with only part of the name (Access 2000)

    If there is only one frontend per PC, I'd give them all the same name.

    Anyhow, try this:
    <code>
    ...
    Dim strPath As String
    Dim strFile As String
    ' Path must have a backslash at the end.
    strPath = "C:BE"
    strFile = Dir(strPath & "FrontEnd*.mdb")
    If strFile = "" Then
    MsgBox "Frontend not found.", vbExclamation
    Exit Sub ' or Function
    End If
    Set dbs = wsp.OpenDatabase(strPath & strFile, False, False, ";PWD=" & strPassword)
    ...</code>

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening datbase with only part of the name (Access 2000)

    This soution does an excellent job and i thank very much for that !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •