Access Database Questions
[Originally posted by Madhat]
Here are a few questions for all you experts out there:
1. In using the VB Data Form wizard I was able to connect to an Access db and all the fields however, the path I specified is C:\Program Files\My Documents\1234.MDB (Example) but when I package the program to distribute it that path is not going to be the same, is there a way to specify a path that depends on the installed path location. i.e. If after installation the path to the program is C:\1234 then the database should reside in C:\1234\1234.MDB.
2. In order to succesfully run a program on a different machine other than mine what do I need to look for during packaging of the program. What do I need to include? Assuming other people do not have Access installed on their computers.
Re:Access Database Questions
[Originally posted by HighCommander]
First of all, Know where your data is located in relaton to your application. Same directory, sub-directory. Then when you program starts, set a variable.
strDataPath = App.Path
strDataPath = App.Path & "\Data"
(You might want to make sure App.Path isn't the root directory. If it is, it will already have the "\")
Then if you use a DataControl, set the property
DatabaseName = strDataPath & "\1234.MDB"
If you use DAO use
OpenDatabase(strDataPath & "\1234.MDB")
The same will apply to other data access methods. How ever you connect to your data, just point to strDataPath & "WhateverDB.MDB"
As far as your second question, use MS Package and deployment wizard, InstallShield, WISE InstallBuilder, and there may be others. They will all (for the most part) make sure all files required to run your app are included in the install package. I typically use WISE. I had a problem once, so I used MS PDW, then looked at the Setup.lst file to see what all files were included, found the one file WISE missed, and then added it to my WISE install. WISE gives me far more flexability than PDW. But the choice is a personal one.