file exists?

10-18-2004, 03:32 PM

I was wondering if you guys had any insight on how to check to see if there is a connection to a database. I have to visit a customer's site that wants to log a db record to the network if the connection to the network is there, but it there is not connection then write it to a local DB.

I wish I could say that they are using ADO or what ever but i have not seen his code yet. So any ideas would be great regardless of the approach.

Thank you so much for your time and possible response.

10-18-2004, 09:13 PM
looks like

if dir$(strPath) = "" then

works great. I found it on another post, guess I should have started there.

10-19-2004, 05:21 PM
Depends, is this an Access database, a SQL Server Database, Oracle?

10-19-2004, 05:50 PM
It is an Access Database

10-19-2004, 05:53 PM
OK, a function would do the trick:

Public Function FileExists(ByVal FileSpec As String) As Boolean
On Error Resume Next
FileExists = (GetAttr(FileSpec) And vbDirectory) = vbNormal
End Function

'Now call the function, passing in the string mdb name

Public Sub checkIfExists()
If FileExists("C:\Testing.mdb") Then
MsgBox "Yes it is there"
MsgBox "no it doesn't exist"
End If
End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum