Data Control

Posted on 1998-08-27
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

Accepted Solution

MikeP090797 earned 50 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!


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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

747 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

12 Experts available now in Live!

Get 1:1 Help Now