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
Solved

Data Control

Posted on 1998-08-27
6
140 Views
Last Modified: 2010-04-30
Hi,
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
0
Comment
Question by:hadorth11
6 Comments
 
LVL 8

Accepted Solution

by:
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
0
 

Expert Comment

by:electrick
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.

0
 

Author Comment

by:hadorth11
ID: 1431539
Hi Mike, Thanks for answering my question but can you show me how to do it. thanks
Lori
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:mcix
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
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1431541
To check if a file exist:

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

0
 

Author Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

807 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