Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problems with ADO from Excel

I am trying to run the following code and I get an error with the following
details:

Runtime Error -2147467259
Automation Error
Unspecified Error

The code looks like the following

Dim wrkRange As Range
Dim last As Integer
Dim i As Integer
Dim MyConn As ADODB.Connection
Dim strConn As String
Dim rstDocs As ADODB.Recordset

Sub ParseContent()
'Get the working Range
Set wrkRange = Application.InputBox("Enter the active range", "Range
Selector", , , , , , 8)
'Find the last cell number
last = wrkRange.Rows.Count
'Opening Database File
'Dim MyConn As New ADODB.Connection
'Dim strConn As String

Set MyConn = New ADODB.Connection
strConn = "Provider=SQLOLEDB;Server=Cronos;" & _
"Database=Papyrus;Integrated Security='SSPI';"

MyConn.Open strConn

'Dim rstDocs As ADODB.Recordset
Set rstDocs = New ADODB.Recordset

rstDocs.Open "Docs", MyConn, adOpenKeyset, adLockOptimistic, adCmdTable


'Start Filling the access database
'Columns A+B to Docs Table
For i = 1 To last
Dim strfield As String

strfield = wrkRange.Cells(i, "A")
rstDocs.MoveLast
rstDocs.AddNew Key_Id, strfield
rstDocs.Update



Next i

End Sub

Any ideas?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Problems with ADO from Excel

Note that using the Jet OLE DB provider or the MS Access/Excel ODBC
driver you could do this in one hit and without a recordset e.g.

INSERT INTO
[ODBC;Driver={SQL Server};SERVER=Cronos;DATABASE=Papyrus;Integrated
Security=SSPI;]. Docs
(KeyID)
SELECT F1 AS KeyID
FROM
[Excel 8.0;HDR=NO;Database=C:\MyWorkbook.xls;].[MySheet$A:A]
;

The source workbook would have to be closed to avoid the dreaded memory
leak bug.

Jamie.

--

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problems with ADO from Excel

http://www.ardice.com/Computers/Prog...Databases/ADO/

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
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
Problems using Excel 2000 to open/save file saved in Excel 2003 [email protected] Excel Discussion (Misc queries) 1 June 29th 05 02:50 AM
2 problems in excel nopfusch Excel Discussion (Misc queries) 2 March 12th 05 09:46 PM
Problems with vb in excel Johnsey[_3_] Excel Programming 2 October 28th 04 08:14 PM
Problems merging an excel file due to code or file problems? Cindy M -WordMVP- Excel Programming 0 September 14th 04 02:58 PM


All times are GMT +1. The time now is 05:56 PM.

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

About Us

"It's about Microsoft Excel"