Results 1 to 3 of 3

Thread: Hot Topic!?!?!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46

    Lightbulb

    Bear with me here....It's going to be a tough explanation.

    I have a VB program that uses an access backend to store data. What I am trying to do is avoid hard coding the location of the database directly into VB (in case the location of the program changes). For instance, I am using this program in 2 different offices. So I had to create 2 different exe files, one with the path for office A and the other for the path of office B. What I am hoping to do is install the database in the same folder with the exe and everything run ok without hard coding the location.

    Please let me know if this is possible.

    Thanks!!!!

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Is the filename constant? (name.mdb?) then you could just do

    open App.Path & "\name.mdb" for....

    so it's the app.path that does the trick! it seeks in the directory of your exe.

    If you don't know you can make a .txt file in the dir of your exe, write the path & file in there (c:\myfiles\db.mdb)
    manually (notepad is the secret word )
    then in your prog open the txt file, extract the path & filename, then use that string to open the database.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    The name stays constant. So in my connection string I could make it something like:

    ConnectionString = ....Source=\name.mdb"

    instead of:
    ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\My Documents\name.mdb"

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