Testing if attached table not present

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I need to be able to test if my back end database is
present or not in case a user happens to delete or move
it. I have downloaded some access code which can be run
from a command button on my main form which allows the
user to relink the attached tables by selecting a
different MDB file but although the code is commented I
don't understand it 100% and don't want to tinker with
it. It also assumes (I think) that a database exists in
the first place and lets the user select an alternative
database. I thought I'd trap the error (err number 3024?)
during the main form open event and call this same code
but this doesn't work.

Can anyone tell me the easiest way to test if the back end
database exists when opening an application and how to re-
attach a new one?

Thanks
 
Can anyone tell me the easiest way to test if the back end
database exists when opening an application and how to re-
attach a new one?

Get the path out of the Connect string from one of the Tabledefs, and test
it with the Dir() function. If you get "" back, then the file is missing,
else it's there.

HTH


Tim F
 
Back
Top