Steve R.
Retired
- Local time
- Yesterday, 22:39
- Joined
- Jul 5, 2006
- Messages
- 5,698
Is there a quick test to verify the status of your SQL connection? We had a network outage today.
I have a "start" form that does not connect to the server until the user selects what they want to do. What I would like is to have the "start" form test the SQL connection before the user makes any selection; otherwise the user will be surprised with an error message.
I just did this for another Access database that is not connected to the SQL server.
I suppose that I could try to open a recordset as a test and if that fails and issue a message based on that. But I am hoping for a less brutish solution.
I have a "start" form that does not connect to the server until the user selects what they want to do. What I would like is to have the "start" form test the SQL connection before the user makes any selection; otherwise the user will be surprised with an error message.
I just did this for another Access database that is not connected to the SQL server.
Code:
Rem Quick check to verify if the data file can be accessed.
If Dir("P:\FEDERAL CONSISTENCY\DATABASES\BackEnd\consistency_be.mdb") = "" Then
MsgBox "Data File NOT Found." & Chr(13) & "Check network connection and file location." & Chr(13) & "P:\FEDERAL CONSISTENCY\DATABASES\BackEnd\consistency_be.mdb"
Else
Rem Nothing, Everything OK.
End If
I suppose that I could try to open a recordset as a test and if that fails and issue a message based on that. But I am hoping for a less brutish solution.