hadorth11
asked on
Data Control
Hi,
All my forms have link with the database by data control. the path look like this "C:\WINDOWS\DESKTOP\scan\S OC.mdb" how about if someone moves the databse from this location, the program will not run! is ther any solution! thanks
All my forms have link with the database by data control. the path look like this "C:\WINDOWS\DESKTOP\scan\S
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Mike, Thanks for answering my question but can you show me how to do it. thanks
Lori
Lori
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
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
To check if a file exist:
If Dir("C:\Windows\Db1.mdb")= "" then 'Not exist
CreateDatabase "C:\Windows\Db1.mdb", dbLangGeneral
Data1.DatabaseName="C:\Win dows=Db1.m db"
Data1.Refresh
End If
If Dir("C:\Windows\Db1.mdb")=
CreateDatabase "C:\Windows\Db1.mdb", dbLangGeneral
Data1.DatabaseName="C:\Win
Data1.Refresh
End If
ASKER
Guys, you are wonderful.. I will give your web address to all my friends!
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.