Results 1 to 3 of 3

Thread: How do I path my database? - (Suggestions or rule of thumb?)

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    13

    Question

    Ok, I have a VB app that accesses an Access database. The application and database are both going to be located in the same directory on the network and then accessed by a few users from networked computers.

    While doing development and debug, things have been working fine because the app and database are both local on my machine. But, when I move the app and database onto the server, the data controls that I set up are currently hard pathed to my c: drive. For development, using data and bound controls, the controls need immediate access to the database in order to give me the choices for field selection for the controls.

    How do I fix this problem? I would hate to have to set up all of these settings at run-time, is there a better way? I would also hate to have to go around to everyones computer and register the database with ODBC. Does anybody understand what I am even saying?

    Thanks,

    Shawn

  2. #2
    Guest
    If you use an ODBC FILE DSN all you have to do to distribute it is copy the *.dsn file to the computers odbc DataSource directory. That can be done eaisely in your setup application(at least it is in install shield, I never use the visual studio P&D wizard). The Datasource directory by Default is c:\program files\commonfiles\odbc\datasources\

    If you don't want to use odbc. create a *.ini file holding the path/s and initialize your controls at startup.

  3. #3
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155

    Exclamation

    A bit of code that has always worked good for me was as follows...
    Code:
    If Right$(App.Path, 1) = "\" Then myPath = App.Path Else myPath = App.Path & "\"
    myFile = myPath & "filename.mdb"
    Works good locally, over a network, on a train, or on a plane.

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