have you tried using ADO, something a bit like the below?
open the conn then open the rst passing in the sql.
you can then build up the sql outside of you connection string, probably be faster than the method you are currently employing (and easy to debug!).
cheers,
Matt.
Public conn As ADODB.Connection
Public rst As ADODB.Recordset
Public MinVal As Double
Function OpenConn()
DBasePath = <UNCPath>
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open DBasePath
End With
End Function
Function CloseConn()
conn.Close
Set conn = Nothing
End Function
Function OpenRst(ByVal sqlstr As String, Optional ByRef clientcol, Optional CountType As String, Optional MinVal As Double)
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = conn
.Open sqlstr, conn
End With
variableCount = rst.Fields.Count
variableValue = rst![column name]
End Function
Function CloseRst()
Set rst = Nothing
End Function
Bookmarks