Solved

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

Posted on 2004-04-01
7
201 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
  • 3
7 Comments
 
LVL 6

Expert Comment

by:mmusante
Comment Utility
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
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Yes rhowella! it's right ... if the user knows HOW MUCH IMPORTANT IS the mdb file ... I prefer do not risk.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now