public goConn as ADODB.Connection
public gDb
'-----------------
sub GetLateRecords()
'-----------------
dim rst
dim sSql as string
 
sSql = "select * from table where [late]=true"
Set rst = getRst(sSql)
range("A1").select
ActiveCell.CopyFromRecordset rst
set rst = nothing
end subs
'-----------------
Public Function getRst(ByVal pvQry) As ADODB.recordset
'-----------------
Dim rst As ADODB.recordset
On Error GoTo errGetRst
If goConn Is Nothing Then ConnectDB
Set rst = CreateObject("ADODB.Recordset")
With rst
    Set .ActiveConnection = goConn
    .CursorLocation = adUseClient
    .PASSWORD = "MYPASSWORD"
    .Open pvQry
End With
Set getRst = rst
 'Set getRst = goConn.Execute(pvQry)
Exit Function
errGetRst:
MsgBox Err.Description, , "getRst():" & Err
End Function
'-----------------
sub ConnectDB()
'-----------------
'BE SURE ADO is put in VBE References:  alt-F11, tools, references.
gDB = "\\server\folder\myDb.accdb"
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & gDB
OLEDB:EngineType=4"
Set goConn = New ADODB.Connection
goConn.Open sConnect
end sub