Kayda
How about using ADO, building your query in Excel, running (say to a recordset) and then returning the output directly to excel?
Here's some sample generic code that may get you going.
Set cn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
cn.Open "provider=microsoft.jet.oledb.4.0;data source = c:\temp\mydb.mdb"
cmd.activeconnection = cn
rs.Open "select * from mytable where myfield = 'mything' group by myfield", activeconnection:=cn
Range("a1").CopyFromRecordset rs
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
rylo
Bookmarks