Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Copy From Recordset

Hi

I am trying to use a recordset to create a clone of data
used in an access database within xl.

the code i have used is as follows

Sub cre_replica_merge()

Dim dbs As Database
Dim rst As Recordset
Dim sql As String
Dim xl As Object

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)
Set xl = CreateObject("excel.application")
sql = "select* from [" & tbl_name & "];"

Set rst = dbs.OpenRecordset(sql)

With xl

.Visible = True
.Workbooks.Add

h = 0
For Each fld In rst.Fields
.ActiveSheet.[a1].Offset(0, h).Value = fld.Name
h = h + 1
Next fld

.activesheet.[a2].copyfromrecordset rst

End With

rst.Close
Set rst = Nothing
dbs.Close

End Sub

When i run this code i get the following error

"Class does not support Automation or does not support
expected interface"

Can anyone help?

TIA

Nath
Reply
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
0 with ADODB Recordset Stefen Percoco Excel Programming 1 July 8th 04 09:54 PM
Type recordset/recordset? FlaviusFlav[_9_] Excel Programming 4 May 24th 04 12:16 PM
Copy Recordset into array? Andrew_blue Excel Programming 2 May 6th 04 07:23 PM
Copy recordset from an Access "make table" query Laurie[_4_] Excel Programming 1 February 5th 04 09:45 AM
Recordset Stephan Kassanke Excel Programming 0 September 10th 03 04:45 PM


All times are GMT +1. The time now is 07:28 AM.

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"