I am trying to determine whether a table exists in Access when a form loads. I've put the FileSystemObject in the form initialize event. I don't know how to reference the table though.
My code is:
Private Sub Form_Initialize()
Dim strSql As String
Dim strFile As String
Dim objFS As FileSystemObject
Set objFS = CreateObject("FileSystemObject"
strFile = "S:\Weddings\Weddings.mdb Temp"
If objFS.FileExists(strFile) Then
strSql = "DROP TABLE Temp"
adoConn.Execute strSql
Else
MsgBox "no temp file exists"
End If
End Sub
When I remove Temp and point it directly at the file, it works, but when I add the table, it goes on to give me the error message.
I haven't been able to find documentation that has an example for a table in a database, so I am thinking that I may be doing this incorrectly.
Any help is greatly appreciated.
Thanks
Cindy
My code is:
Private Sub Form_Initialize()
Dim strSql As String
Dim strFile As String
Dim objFS As FileSystemObject
Set objFS = CreateObject("FileSystemObject"
strFile = "S:\Weddings\Weddings.mdb Temp"
If objFS.FileExists(strFile) Then
strSql = "DROP TABLE Temp"
adoConn.Execute strSql
Else
MsgBox "no temp file exists"
End If
End Sub
When I remove Temp and point it directly at the file, it works, but when I add the table, it goes on to give me the error message.
I haven't been able to find documentation that has an example for a table in a database, so I am thinking that I may be doing this incorrectly.
Any help is greatly appreciated.
Thanks
Cindy