Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple-step OLE DB operation generated errors

Hello,

I have an Excel Spreadsheet that I am pulling information
into using VBA. I am able to propogate data into the
spreadsheet using ADO.

My problem is that when I attempt to update the info
using a different ADO query, it updates the first row,
but then gives me the error message
"Multiple-step OLE DB operation generated errors"

Here is the code I am using:

Dim cnnConnectSpec As String
Dim cmd As New ADODB.Command
Dim cnn As New ADODB.Connection
Dim objRs As New ADODB.Recordset
Dim prm As ADODB.Parameter
Dim prm1 As ADODB.Parameter
Dim prm3 As ADODB.Parameter
Dim wksStocks As Worksheet
Dim i As Integer
Dim FinalRow As Long

Set wksPrePlan = ThisWorkbook.Worksheets("Preplanning")
FinalRow = wksPrePlan.Cells(65536, 1).End(xlUp).Row

cnn.Open "DSN=ELCDEVEL;uid=user;pwd=passwd"

cmd.CommandText = "UPDATE LEGSUM set LS_USER_2 = ? " & _
", LS_USER_3 = ? " & _
" WHERE LS_TRIP_NUMBER = 62142 "
cmd.CommandType = adCmdText

'cmd.Prepared = True

' Create new parameter for PrePlan Driver
Set prm = cmd.CreateParameter("PP_DRV", adVarChar, _
adParamInput, 4)
cmd.Parameters.Append prm
' Create new parameter for PrePlan Driver
Set prm1 = cmd.CreateParameter("PP_PUNIT", adVarChar, _
adParamInput, 4)
cmd.Parameters.Append prm1
' Create new parameter for PrePlan Driver
Set prm2 = cmd.CreateParameter("TRIPNUM", adInteger,
adParamInput, 5)
cmd.Parameters.Append prm2

' Connect to the data source.
cmd.ActiveConnection = cnn

For i = 2 To FinalRow
cmd("PP_DRV") = wksPrePlan.Cells(i, 8)
cmd("PP_PUNIT") = wksPrePlan.Cells(i, 9)
cmd("TRIPNUM") = wksPrePlan.Cells(i, 1)
wksPrePlan.Cells(i, 12) = _
"Uploaded Trip"
cmd.Execute
Next i

'clean up
'objRs.Close
cnn.Close
Set objRs = Nothing
Set cnn = Nothing
Set cmd = Nothing

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Multiple-step OLE DB operation generated errors

"Jeff" wrote ...

Hello,

I have an Excel Spreadsheet that I am pulling information
into using VBA. I am able to propogate data into the
spreadsheet using ADO.

My problem is that when I attempt to update the info
using a different ADO query, it updates the first row,
but then gives me the error message
"Multiple-step OLE DB operation generated errors"


Without you posting details such as DBMS product, schema info and test
data, it's hard to reproduce and therefore diagnose the problem. As a
guess, it could be a data type mismatch or a problem with a null
value.

Jamie.

--
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
excel.exe has generated errors and will be shutdown by windows jcook Excel Discussion (Misc queries) 0 April 22nd 08 02:20 PM
Excel error while trying to import data from an Access database - MSQRY32.exe has generated errors X_HOBBES Excel Discussion (Misc queries) 0 March 15th 05 06:46 PM
excel.exe has generated errors Mrich Excel Discussion (Misc queries) 7 December 31st 04 09:28 PM
Excel.exe has generated errors Mrich New Users to Excel 6 December 31st 04 09:28 PM
"Multiple-step operation generated errors" Michael Daly Excel Programming 2 December 22nd 03 09:30 AM


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

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"