Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel.exe has generated errors and will be shutdown by windows | Excel Discussion (Misc queries) | |||
Excel error while trying to import data from an Access database - MSQRY32.exe has generated errors | Excel Discussion (Misc queries) | |||
excel.exe has generated errors | Excel Discussion (Misc queries) | |||
Excel.exe has generated errors | New Users to Excel | |||
"Multiple-step operation generated errors" | Excel Programming |