LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default ADO to pull data from Access query

I'm trying to connect to an Access database and pull the data from an access
query into a resordset and copy that recordset into excel.

This code stops when the connection tries to open. I have several
spreadsheets where I do this with SQL Server, but can't seem to get it right
when connecting to Access.



Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\Documents
and Settings\brogers\Desktop\Brad and Mary's DB.mdb;")

Dim cmd As New ADODB.Command

cmd.ActiveConnection = cnn
cmd.CommandText = "[S_08]" ' this is the name of the Access query
cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
cmd.CommandTimeout = 0

Dim rst1 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
rst1.Open (cmd) '''''''''''''''''''''''''''' this is where the
code stops


Worksheets("Sheet1").Range("A2").CopyFromRecordset rst1


--
Billy Rogers

Dallas,TX

Currently Using SQL Server 2000, Office 2000 and Office 2003
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DSUM to pull data from Access DB Brian Excel Worksheet Functions 2 May 12th 09 11:21 PM
Applying Criteria in Excel Cell to MS Query Pull from Access Tony Excel Discussion (Misc queries) 1 February 1st 08 04:43 PM
Microsoft Query - pull data from Access "Too many parameters" Donica Excel Programming 0 April 11th 07 05:18 PM
Can excel pull data out of access? Matt Setting up and Configuration of Excel 0 October 18th 06 05:40 PM
How To Pull Access Query into Excel (2003): Reposting Bettergains Excel Programming 2 December 8th 04 02:19 AM


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"