Enigmachrysalis
Active Member
- Joined
- Apr 13, 2009
- Messages
- 350
Both of these start the same:
Dim cnn as ADODB.Connection
Set cnn = New ADODB.Connection
but I have seen both of the following work:
Option #1
With cnn
.Provider = 'Provider string here
.Open 'Cnxn string here
End With
Option #2
cnn.Open 'Provider string & cnxn string here
The latter seems simpler, but I see the former in so many examples that I began to wonder if it is preferable for some reason. Is there any advantage to the first option?
Dim cnn as ADODB.Connection
Set cnn = New ADODB.Connection
but I have seen both of the following work:
Option #1
With cnn
.Provider = 'Provider string here
.Open 'Cnxn string here
End With
Option #2
cnn.Open 'Provider string & cnxn string here
The latter seems simpler, but I see the former in so many examples that I began to wonder if it is preferable for some reason. Is there any advantage to the first option?