Data Control

Posted on 1998-08-27
Medium Priority
Last Modified: 2010-04-30
All my forms have link with the database by data control. the path look like this "C:\WINDOWS\DESKTOP\scan\SOC.mdb"  how about if someone moves the databse from this location, the program will not run! is ther any solution! thanks
Question by:hadorth11
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

Accepted Solution

MikeP090797 earned 150 total points
ID: 1431537
Check on startup if the file exist, using Dir. If it doesn't, either create an empty database, or ask the use to enter the database path using Open File Dialog

Expert Comment

ID: 1431538
You could write a routine to check for the existance of your
database file.  If it has been moved, then you could have a
routine look for it, then change the databasename property
to the new path.  I built an activeX control to do this.


Author Comment

ID: 1431539
Hi Mike, Thanks for answering my question but can you show me how to do it. thanks
Technology Partners: 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!


Expert Comment

ID: 1431540
In addition to the proposed solution, you could store the Database Name in an INI/Registry setting.

In the Form_Initialize Event you would read the Setting and verify the existence of the DB.

If the file/path are good, set the datacontrol.databasename = INI setting

Expert Comment

ID: 1431541
To check if a file exist:

If Dir("C:\Windows\Db1.mdb")="" then 'Not exist
 CreateDatabase "C:\Windows\Db1.mdb", dbLangGeneral
End If


Author Comment

ID: 1431542
Guys, you are wonderful.. I will give your web address to all my friends!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 18 hours left to enroll

762 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