This is an example along the lines of what Zvoni suggests (I think...chime in if I'm wrong, Z!). The code runs an SQL select statement against an Access DB (reference to Microsoft Access Object Library is required) and populates the results into the active worksheet, then gives you a message indicating how many records were returned.
Code:
Sub runQuery()
Dim varConn As String
Dim varSQL As String
Range("A1").CurrentRegion.ClearContents
varConn = "ODBC;DBQ=vbmain.mdb;Driver={Driver do Microsoft Access (*.mdb)}" 'connect to my Access DB
varSQL = "SELECT tblnames.f1 FROM tblNames" 'simple SQL select statement, selects F1 (field 1) from tblNames
With ActiveSheet.QueryTables.Add(Connection:=varConn, Destination:=Range("A1")) 'place SQL results in A1 (active sheet)
.CommandText = varSQL
.Name = "Query-39008"
.Refresh BackgroundQuery:=False
End With
MsgBox "Rows in Excel: " & Range("a1").End(xlDown).Row - 1 'show how many records got populated
End Sub