sql querries

  • Thread starter Thread starter delali
  • Start date Start date
D

delali

Hi,
this is an excel/access question. i was wondering how to
make excel run a querry in access and put the result of
the querry into a spreadsheet.

thanx a lot
 
-----Original Message-----
Hi,
this is an excel/access question. i was wondering how to
make excel run a querry in access and put the result of
the querry into a spreadsheet.

thanx a lot
.

Turn DAO reference on:
Sub Ret_Acc_Qry

Dim dbs as database
dim sql as string
dim rst as recordset

fname = "filename of database"

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)

sql = "sql statement"

set rst = dbs.openrecordset(sql)
h=0

for each fld in rst.fields
activesheet.[a1].offset(0,h).value = fld.name
next fld

activesheet.range("a2").copyfromrecordset rst

dbs.close
end sub
 
-----Original Message-----
Hi,
this is an excel/access question. i was wondering how to
make excel run a querry in access and put the result of
the querry into a spreadsheet.

thanx a lot
.
Sorry before next fld in my response you need h=h+1

nath
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top