Err.Number for missing BE.mdb

R

Roy Ristie

Hi folks,

does anyone know which error is generated when the FE can not find the BE ?
and can this be inspected using VBA.

Background.

I've included Dev Ashish's routine in my project. this works ok but I 'm
required to reconnect every time I start the application.
I want to modify this behaviour by only calling the function after I've
found that the connection is broken ie. when the BE has been moved.

btw. I'm using access 2K SP3 running on WinXP SP2.

thanks for any help

Roy
 
E

elwin

I use the Dir() function to determine if my backend is where I expect it to
be. If the drive mapping isn't in place error #52 is returned. I call the
function in the OnOpen event of my switchboard, and cancel the event if it
returns false. As you can see I've hard coded the path of my backend, but if
you wanted to you could loop through your TableDefs collection to parse out
the location of your backend from the connection property of your linked
tables. Not sure if this was what you're looking for, but I hope it gives
some ideas.


Function GoodNetwork() As Boolean
On Error GoTo Err_Handler
Dim str As String
str = Dir("K:\Lunch\Data\LunchData.mdb")
If str = "" Then
MsgBox "Database(s) not found.", vbCritical, _
"Launch Aborted"
Else
GoodNetwork = True
End If
Exit Function
Err_Handler:
Select Case Err
Case 52 'server not found
MsgBox "Server not found. Data links could " _
& "not be refreshed.", vbExclamation, _
"Launch Aborted"
Case Else
MsgBox Err.Description, vbExclamation, _
"Launch Aborted"
End Select
End Function
 
R

Roger Carlson

On my website (www.rogersaccesslibrary.com) is a small sample database
called "RelinkOnOpen.mdb" which checks each linked table to see if it needs
re-linking before it re-links it. (It works for linked Excel sheets as
well.) The code is in the subroutine called Startup in the PublicFunctions
module.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
L

Larry Daugherty

Hi,

You can generalize it much further than that. As I recall, I test one of
the linked tables and, if it fails I first look for the Back End in the path
of the Front End, if that also fails, I bring up the graphical Get File
dialogue and navigate to the back end and hook it up.

All of this stuff is available at www.mvps.org/access It requires a lot of
thinking and machinations to get it to do what you want but then you'll have
a nifty facility to include with your applications. It still works just
fine if the Front End is an MDE.

As I wrote this it occurred to me that I haven't generalized it as far as it
should go either. I've hard wired the name of the linked table to test and
haven't worked out how to handle the situation of links into more than one
external MDB.

HTH
 
R

Roy Ristie

Hi Roger,

I'll look into that

Thanks,
Roy


Roger Carlson said:
On my website (www.rogersaccesslibrary.com) is a small sample database
called "RelinkOnOpen.mdb" which checks each linked table to see if it
needs
re-linking before it re-links it. (It works for linked Excel sheets as
well.) The code is in the subroutine called Startup in the
PublicFunctions
module.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
R

Roy Ristie

Hi Elwin,

yes TableDefs suggesion is the type of thing I'm looking for.
The other thread also gave me some food for thought.

Thanks
Roy
 
Top