Click to See Complete Forum and Search --> : Deployment Question--where to put file
brainhurts
Jul 6th, 2005, 04:36 PM
Problem: When I install the application it can't find my access file.
I have several forms in my project, on 2 of them I have a data sources both with an access file located in c:\nada\temp\question.mdb.
How do I handle those when installing on another computer. I'm using Visual Studio Installer, and am very unclear on how to properly handle this.
Does the installer have to create a file exactly as I have coded it, or should I be coding it differently, or do I not know what I'm doing with the VSInstaller.
Thanks---obvious newbie here
:wave:
RobDog888
Jul 6th, 2005, 06:03 PM
Sounds like your "hard coding" your db path. Dont, use a relative path if the db is going to be in the exe's directory.
What is your app written in? VB6/VB.NET, etc.
Mark Gambo
Jul 6th, 2005, 09:00 PM
Problem: When I install the application it can't find my access file.
I have several forms in my project, on 2 of them I have a data sources both with an access file located in c:\nada\temp\question.mdb.
How do I handle those when installing on another computer. I'm using Visual Studio Installer, and am very unclear on how to properly handle this.
Does the installer have to create a file exactly as I have coded it, or should I be coding it differently, or do I not know what I'm doing with the VSInstaller.
Thanks---obvious newbie here
:wave:
how many persons will be using the database at one time? If more than 5 or 10 I would suggest you consider upgrading to a real db server such as MySQL, MSDE or Postgre, all of which are open source (read FREE!!). Then you can connect to these DB via an ODBC Connection. Access was designed to be a desktop application and not a network application.
brainhurts
Jul 7th, 2005, 08:46 AM
I'm using VB6. This will be a 1 person at a time application. Users will operate from their own database.
"Sounds like your "hard coding" your db path. Dont, use a relative path if the db is going to be in the exe's directory."
How do I do that?
brainhurts
Jul 7th, 2005, 05:13 PM
Anyone? How do I use a relative path in the exe's directory?
RobDog888
Jul 7th, 2005, 07:26 PM
I'm back. Hard coding the paths is like when you put the path in your connection string that is related to your systems path.
Then when you install to another system with a different path it will error.
A relative path would be like using the App.Path function. It retrieves the path of where you app is located. So if you install your db
to the same folder as you exe you will always be able to know the path on any system its installed to.
How are you connecting to the DB? ADO, DAO, ODBC, etc. Can you post your connection code?
brainhurts
Jul 8th, 2005, 10:13 AM
Okay i'm a little confused. My connection code? ummm..you mean this?
Dim WRdb As Database, WRTable As Recordset
Set WRdb = Workspaces(0).OpenDatabase("\\Zac\Visual Basic6\DirtBike\moto")
' Open table.
Set WRTable = WRdb.OpenRecordset("mototable", dbOpenTable)
This is just me opening my db which is obviously stored in above folder.
The properties of my data source are also linked to the above folder.
I understand the concept of having the db file in the same place as the exe, but I need a little coddling here..picture, step by step or hammer.
'please pardon me as i'm a self taught newbie with no formal training!
Thanks for helping me
Besoup
Jul 8th, 2005, 10:33 AM
If you have your DB in the same directory as the .exe you could use:
Dim WRdb As Database, WRTable As Recordset
Set WRdb = Workspaces(0).OpenDatabase(App.Path & "\moto")
' Open table.
Set WRTable = WRdb.OpenRecordset("mototable", dbOpenTable)
That should work but I am kinda a rookie too.
RobDog888
Jul 8th, 2005, 11:00 AM
So your using DAO. If all users are running the db locally (on their system) then the app.path suggestion is the way to go.
Besoup posted correct code. The thing is that if you dont have a share called "Visual Basic6" then the path is invalid. Its not a
filesystem path unless you use the Admin share like - "\\Zac\C$\Visual Basic6\DirtBike\moto".
brainhurts
Jul 11th, 2005, 01:40 PM
okay...what do I put as the database name in properties? Just moto? moto.mdb? \\moto?...etc?
thanks
kfcSmitty
Jul 11th, 2005, 01:42 PM
I open them using the file extension. IE) App.Path & "\moto.mdb"
brainhurts
Jul 11th, 2005, 02:29 PM
I had already tried that, it tells me file not valid when I run it. Do I actually need to install the program and run it for it to work? That can't be right!!!!!
----------pulling hair-----------------
I tried just almost every combination for the database name---nothing working..i must have something else wrong in my project!!!
kfcSmitty
Jul 11th, 2005, 02:34 PM
add msgbox app.path
to find out where its pointing and edit your line based on that
brainhurts
Jul 11th, 2005, 02:53 PM
It's going to c:\Zac\Visual Basic6\DirtBike\...which is the same folder as my exe. Which is exactly my problem. When I install this on someone else machine this won't work.
The database opens using the app path code BESOUP recommended, but won't work on someone else's machine with the database name as c:\zac\etc\etc....
kfcSmitty
Jul 11th, 2005, 02:59 PM
as long as you have the .mdb in the same directory relevant to the executable, app.path should suffice.
If it were on someone elses pc, the path could very well be "C:\Program Files\Travis Smith"
Besoup
Jul 11th, 2005, 03:01 PM
It's going to c:\Zac\Visual Basic6\DirtBike\...which is the same folder as my exe. Which is exactly my problem. When I install this on someone else machine this won't work.
The database opens using the app path code BESOUP recommended, but won't work on someone else's machine with the database name as c:\zac\etc\etc....
Ok so you are installing the App without the DB on other machines? If that is the case you just need to make sure your DB is in a shared directory ie. "\\Zac's Computer\Visual Basic6\Dirtbike\....."
brainhurts
Jul 11th, 2005, 03:08 PM
Here's a visual of my prob.
brainhurts
Jul 11th, 2005, 03:09 PM
Ok so you are installing the App without the DB on other machines? If that is the case you just need to make sure your DB is in a shared directory ie. "\\Zac's Computer\Visual Basic6\Dirtbike\....."
No...no..that's what I need to do. The app and the DB will be installed on other machines.
Besoup
Jul 11th, 2005, 03:13 PM
Here's a visual of my prob.
My original solution was only good if you were packaging and deploying the DB with the application. If you are having all your users access the same database through a LAN, you will have to use the full path of the shared directory that you will be keeping it.
Besoup
Jul 11th, 2005, 03:15 PM
No...no..that's what I need to do. The app and the DB will be installed on other machines.
Ok then if that is the case you could add a line on the form_load event like:
Data1.DatabaseName = App.Path & "\moto.mdb"
And leave it blank in the properties of Data1.
brainhurts
Jul 11th, 2005, 03:23 PM
Awesome...that was the magic I was looking for!!!
Thanks all..Problem Resolved
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.