OpenRecordSet

G

Guest

Hello,

How can I bring in the Field Names or Column Titles into
Excel when using the OpenRecordSet method to import a
table from Access to Excel? Currently it only brings in
the records.

Current Code:

Set dba = OpenDatabase("C:\file.mdb", False,
False, ";pwd=password")
Set rst = dba.OpenRecordset("Table", dbOpenDynaset,
dbReadOnly)
 
A

Alex Dybenko

you can go through fields collection, something like below:


dim fld as field
i=2

for each fld in rst.fields
cell(1,i)=fld.name
i=i+1
next fld
 

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

Top