Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Dynamic database pathways...

Dynamic database pathways...

Scheduled Pinned Locked Moved Database
databasequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    new_phoenix
    wrote on last edited by
    #1

    Is there a way to make a database connection more dynamic, so that the database could be moved to a different directory and still function without requiring the need to change the path in the database code itself? The code I have so far is static and requires changing each time the MS Access file moves or is moved to a different directory.

    Dim strDBPath As String
    strDBPath = "J:\GELCO DATABASE\Headcount Database\Headcount Database.mdb"
    Set dbsHeadcount = OpenDatabase(strDBPath)

    H 1 Reply Last reply
    0
    • N new_phoenix

      Is there a way to make a database connection more dynamic, so that the database could be moved to a different directory and still function without requiring the need to change the path in the database code itself? The code I have so far is static and requires changing each time the MS Access file moves or is moved to a different directory.

      Dim strDBPath As String
      strDBPath = "J:\GELCO DATABASE\Headcount Database\Headcount Database.mdb"
      Set dbsHeadcount = OpenDatabase(strDBPath)

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      usually, connection strings, paths, etc are stored in configuration files so changing them does not require changing code. You should adopt this practice in general.


      Hesham A. Amin My blog

      N 1 Reply Last reply
      0
      • H Hesham Amin

        usually, connection strings, paths, etc are stored in configuration files so changing them does not require changing code. You should adopt this practice in general.


        Hesham A. Amin My blog

        N Offline
        N Offline
        new_phoenix
        wrote on last edited by
        #3

        Could you explain where the configuration file is in Microsoft Access? I understand in a web application, there is a configuration file, but what about in a networked version of MS Access?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups