Question Locked

VBScript

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi All,

I need ur help.

I want to do the following using vbscript

1. Connect to Access database.
2. Fectch data using SELECT query
3. Copy the result of select query to excel file.

Plz help me out.

2 replies

by p.j.hutchison

You would use VBA using something like:

1. Open a Connection using ODBC to Access database using Microsoft Access Driver
2. Create SQL Command
3. Associate SQL command with connection
3. Assign a SQL Select command string to the SQL Command.CommandText
4. Run the SQL Command to create a REcordset
5. Open a connection using ODBC to Excel spreadsheet
6. Read Access table until end
6.a. REad a record from tabl
7.b. Assign value from record to a Sheet and Cell in Excel spreadsheet
7.c Repeat 7.b until done
8. Close connections

For connections see http://www.codeproject.com/KB/database/connectionstrings.aspx#Access

This discussion is closed to new replies.