Thursday, September 13, 2007

Get data from MS Access using ADODB.

Use the below code to retrieve the data from access database.

Dim DB as new ADODB.DATABASE
dim RS as New ADODB.Recordset
set db = ("Some File Name")
set rs = db.openrecordset("Tablename")

while not rs.eof
cells(x,1) = rs(0)
rs.movenext
wend

1 comment:

  1. Hi Ayush,

    This is Amit and I am looking for a VB Code through which I can extract all the information from Access Tables. The table I have in Excell contains the following fields.

    Client Id: Unique
    Client Name
    Notes;
    Attachment: Contains attachment of any type of files or mails.

    Now I need a code via which from Excel I can extract the above information. Also, in case there are multiple attachments under Attachment field how it will appear in Ms Excel when I extract the information. One more thing I would like to know Can I make a change in the attachment if yes.. Will it save in the database automatically.

    Plesae help me out in this.

    Thanks

    Amit Jain

    ReplyDelete