|
-
Jul 12th, 2006, 10:25 AM
#1
Thread Starter
Junior Member
[RESOLVED] Database Location
Hi All,
I wrote a VB6 program wherein I am storing a number of public variables in a very simple access database. My questions:
1. Once I distribute the program, how can I tell the program where the Access program is located in the end user's computer if I don't know in which directory the user installed Access.
2. What happens if the user does not have Access in their computer and my program calls Access? Will my program crash?
I appreciate your help.
Ace
-
Jul 12th, 2006, 10:35 AM
#2
Re: Database Location
The answers to both of your questions could be very simple, but I'm afraid you havent given us enough information.
How are you connecting to the database? (eg: ADO code, DAO code, Data Control).
What code are you using (or if you are using a Data Control, what properties have you set)?
-
Jul 12th, 2006, 01:55 PM
#3
Thread Starter
Junior Member
Re: Database Location
 Originally Posted by si_the_geek
The answers to both of your questions could be very simple, but I'm afraid you havent given us enough information.
How are you connecting to the database? (eg: ADO code, DAO code, Data Control).
What code are you using (or if you are using a Data Control, what properties have you set)?
Well right now, I only created the database but have not connected to it yet. I intend on using a data control though. The only reason I am using a database is so I can use crystal reports to create a report based on the user's data (I understand that is the easiest way to use Crystal). After the report is created, I would like the program to delete the data from the database because the information need not be saved.
I guess I'm just looking for something simple to make sure my program finds the end user's Access program and doesn't crash.
I really appreciate your help.
Ace
-
Jul 12th, 2006, 04:04 PM
#4
Re: Database Location
Data controls are far from ideal, and will cause problems for at least one of your questions - see here for an explanation of why bound controls are bad.
I would recommend using ADO code instead (see the ADO Tutorial link in my signature for an example).
If you use that, your first question is solved by simply putting the path of the database into your connection string (probably using App.Path - which is the same folder as your program), and your second question is solved by installing MDAC (link below).
-
Jul 12th, 2006, 05:05 PM
#5
Re: Database Location
 Originally Posted by AceFlyer
The only reason I am using a database is so I can use crystal reports to create a report based on the user's data (I understand that is the easiest way to use Crystal).
I find the easiest way is to create a disconnected (not connected to any database) ADO recordset and send that recordset to Crystal, regardless of whether the recordset gets filled from a database, a text file, user input or anything else.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 12th, 2006, 08:40 PM
#6
Thread Starter
Junior Member
Re: Database Location
 Originally Posted by Al42
I find the easiest way is to create a disconnected (not connected to any database) ADO recordset and send that recordset to Crystal, regardless of whether the recordset gets filled from a database, a text file, user input or anything else.
Thank you all for the great replies. I'll get to work and I'm sure with your suggestions, it will work.
Thanks Again....
Ace
-
Jul 13th, 2006, 07:10 AM
#7
Addicted Member
Re: [RESOLVED] Database Location
simply putting the path of the database into your connection string (probably using App.Path - which is the same folder as your program)
so how would I actually input that? right now it looks like this
VB Code:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\Documents and Settings\Owner\My Documents\BB\Congo VB\db1.mdb"
so how would I use the "App.Path"?
thanks
-
Jul 13th, 2006, 07:14 AM
#8
Re: [RESOLVED] Database Location
By using simple string manipulation. 
VB Code:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=[u]" & App.Path & "[/u]\db1.mdb"
-
Jul 13th, 2006, 07:15 AM
#9
Addicted Member
Re: [RESOLVED] Database Location
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|