Hi Guys,
I am having a problem with a late binding conversion with ADO. I have
the following sub which is designed to be passed an ADO connection
object and also the full path to the .mdb file, then if the file
actually exists attempt a connection to it.
Sub ConnectMDB(ByRe f connector As Object, ByVal filename As String)
Set connector = Nothing
Set connector = CreateObject("A DODB.Connection ")
If FileExists(file name) Then
'Set connector = New ADODB.Connectio n
With connector
.Provider = "Microsoft.Jet. OLEDB.4.0"
.ConnectionStri ng = "Data Source = " & filename & ";"
.Mode = adModeShareExcl usive
.Open
End With
End If
End Sub
There seems to be an issue with the adModeShareExcl usive. When I try
and use the code I am receiving a 'Variable not defined' on the mode
setting (it is highlighted) and the execution stops on the first line
of the sub. It works fine when the reference exists, but not without
it seems.
Any ideas?
The Frog
I am having a problem with a late binding conversion with ADO. I have
the following sub which is designed to be passed an ADO connection
object and also the full path to the .mdb file, then if the file
actually exists attempt a connection to it.
Sub ConnectMDB(ByRe f connector As Object, ByVal filename As String)
Set connector = Nothing
Set connector = CreateObject("A DODB.Connection ")
If FileExists(file name) Then
'Set connector = New ADODB.Connectio n
With connector
.Provider = "Microsoft.Jet. OLEDB.4.0"
.ConnectionStri ng = "Data Source = " & filename & ";"
.Mode = adModeShareExcl usive
.Open
End With
End If
End Sub
There seems to be an issue with the adModeShareExcl usive. When I try
and use the code I am receiving a 'Variable not defined' on the mode
setting (it is highlighted) and the execution stops on the first line
of the sub. It works fine when the reference exists, but not without
it seems.
Any ideas?
The Frog
Comment