Determining the file location of the back-end

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • evenlater

    Determining the file location of the back-end

    I know how to determine the file location of the current Access
    database in VBA. But I'm trying to figure out how to determine the
    file location of my back-end. Anybody know how I can call up the path
    & name of the .mdb with my tables in it -- from a module in my front-
    end?
  • ruralguy via AccessMonster.com

    #2
    Re: Determining the file location of the back-end

    See if this little piece of code helps:

    Public Function ShowTables()
    Dim I As Integer
    With CurrentDb
    For I = 0 To .TableDefs.COUN T - 1
    If Len(Trim(.Table Defs(I).Connect )) 0 Then
    Debug.Print .TableDefs(I).C onnect
    Debug.Print .TableDefs(I).S ourceTableName
    End If
    Next
    End With
    End Function


    evenlater wrote:
    >I know how to determine the file location of the current Access
    >database in VBA. But I'm trying to figure out how to determine the
    >file location of my back-end. Anybody know how I can call up the path
    >& name of the .mdb with my tables in it -- from a module in my front-
    >end?
    --
    RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
    Please post back to this forum so all may benefit.

    Message posted via AccessMonster.c om


    Comment

    • Stuart McCall

      #3
      Re: Determining the file location of the back-end

      "evenlater" <evancater@gmai l.comwrote in message
      news:843f360e-c8cd-4091-b191-06c4daaff141@k3 7g2000hsf.googl egroups.com...
      >I know how to determine the file location of the current Access
      database in VBA. But I'm trying to figure out how to determine the
      file location of my back-end. Anybody know how I can call up the path
      & name of the .mdb with my tables in it -- from a module in my front-
      end?
      CurrentDb.Table Defs("My Linked Table").Connect

      will give you the path to the BE file.


      Comment

      • evenlater

        #4
        Re: Determining the file location of the back-end

        That's what I'm looking for! Thanks!

        Comment

        • John Mishefske

          #5
          Re: Determining the file location of the back-end

          evenlater wrote:
          That's what I'm looking for! Thanks!
          Couple of additional things to consider:

          - most split apps have only one BE file but it is certainly possible to
          link to tables in more than one BE file. Uncommon but just something to
          be aware of.

          - you'll want to ensure that the BE actually exists. No error is raise
          when opening a FE with linked tables to a BE that doesn't exist - you'll
          want to code for that possibility.

          Good luck on the project!

          --
          '--------------------------
          ' John Mishefske
          ' UtterAccess Editor
          ' Microsoft MVP 2007, 2008
          '--------------------------

          Comment

          • Tony Toews [MVP]

            #6
            Re: Determining the file location of the back-end

            John Mishefske <mishej@execpc. comwrote:
            >- most split apps have only one BE file but it is certainly possible to
            >link to tables in more than one BE file. Uncommon but just something to
            >be aware of.
            Indeed. I have have code in a few databases that, on startup, double checks that all
            tables are linked to the same backend. Just belts and suspenders programming.
            >- you'll want to ensure that the BE actually exists. No error is raise
            >when opening a FE with linked tables to a BE that doesn't exist - you'll
            >want to code for that possibility.
            Another good point. This is as simple is opening a recordset based on a table
            preferably with only a few records in it. If the open succeeds that all is well.

            Tony
            --
            Tony Toews, Microsoft Access MVP
            Please respond only in the newsgroups so that others can
            read the entire thread of messages.
            Microsoft Access Links, Hints, Tips & Accounting Systems at

            Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

            Comment

            Working...