?
Solved

creating or copying Database(Access) via setup or by algo 4 1st time?

Posted on 2004-04-01
7
Medium Priority
?
211 Views
Last Modified: 2010-04-17
given-> i have develped a package in visual basic & its database is in access 2000. Now i have prepared its setup but while i run the package after its installation via setup it shows me that required database named 'Mis.mdb' is not found.

For that i have to manually copy it (mid.mdb) into the current path of application say '.\database\mid.mdb' . (don't want this solution)

problem is ->
But i want it to be copied via my application's first time setup. i mean i want to happen automatcially so that it can hidden from its user.

better solution if algo given
Thankx
0
Comment
Question by:tomerps1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 
LVL 6

Expert Comment

by:mmusante
ID: 10738889
if you use DAO you can create your DB using the CreateDatabase method ...

Dim wrkDef As Workspace
Dim dbsNew As DATABASE

Set wrkDef = DBEngine.Workspaces(0)

If Dir("MyDB.mdb") <> "" Then Kill "MYDB.mdb"

Set dbsNew = wrkDef .CreateDatabase("MyDB.mdb", dbLangGeneral, dbEncrypt)

... after that you have to create by code all your DB tables using execute method

dbsNew.execute "CREATE TABLE ...
0
 

Author Comment

by:tomerps1
ID: 10738954
But My Dear Friend
 
it's very tedious. I have around 180 tables. Many Of them are filled up with 1000- 20000 records (default supplied with database) with many columns. is there any other way ? i am using 'adodb' to access ACCESS.
0
 
LVL 6

Accepted Solution

by:
mmusante earned 200 total points
ID: 10738988
OK ... The easy way ...
Make an installation package (VB has an'utility to do this) and add your MDB to the package (I suggest in the application path)

... the drawback ...
If somebody uninstall your software he loose his data

... the solution ...
Make a copy of original DB on first execution and work on it (uninstall will not delete this file)

If Dir(App.path & "\MyDB2.mdb") = ""  then
    shell("Copy " & app.path & "\MyDb.mdb " & app.path & "\MyDB2.mdb ")
endif
0
 

Expert Comment

by:rhowella
ID: 10745962
Recreate your installation package and include your database in the package. When the package prompts you to mark "SHARED FILES", mark the checkbox your database, this way, even if the user uninstalls the program, the database can be preserved. during uninstallation the user has the option to keep/delete the shared file.
0
 
LVL 6

Expert Comment

by:mmusante
ID: 10755258
Yes rhowella! it's right ... if the user knows HOW MUCH IMPORTANT IS the mdb file ... I prefer do not risk.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question