bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
Hi,
I am using the following ADO connection and I am not sure why but depending on the query the recordset value for a string may be cut off. Maybe there is some sort of restriction for ADO data transfers or for Recordsets?
I am using the following ADO connection and I am not sure why but depending on the query the recordset value for a string may be cut off. Maybe there is some sort of restriction for ADO data transfers or for Recordsets?
Code:
Public Sub SQLOpenDatabaseConnection(StrDBPath As String, EngineType As Integer)
'Define Connection String by inputting StrDBPath into a larger string (Works for Excel DB)
'Define Connection String by inputting StrDBPath into a larger string
'Access Support for engine type
If EngineType = 0 Then
sConn = "Provider=Microsoft.ACE.OLEDB.15.0;" & _
"Data Source=" & StrDBPath & ";" & _
"Jet OLEDB:Engine Type=5;" & _
"Persist Security Info=False;Mode=Share Exclusive;"
'Excel Support for engine type
ElseIf EngineType = 1 Then
sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & StrDBPath & "';" & _
"Extended Properties=""Excel 12.0;HDR=NO;ReadOnly=0;"";"
End If
RetryConnection:
DoEvents
On Error GoTo ErrorHandler
'Connect to the database
20 oConn.Open sConn
On Error GoTo 0
Exit Sub
ErrorHandler:
'triggered by connection error. Most likely locking type
'MsgBox "looks like we had a connection error. The error number is " & Err.Number & " and the description is " & Err.Description & " on line " & Erl
Err.Clear
Resume RetryConnection
End Sub
Last edited: