Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-04-01
7
Medium Priority
?
212 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

636 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