Solved

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

Posted on 2004-04-01
7
210 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 50 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

726 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