Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : simple update in VBASearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v8 Forum

 New Topic 
 
 Post Reply 
[1]  
 simple update in VBA 
 Author   Message 
  Trevor 
  
 Group: Members 
 Posts: 4 
 Joined: 2008-05-06 
 Profile
 Posted : 2008-05-06 08:19:13

I am using the trial version of QODBC, and i am attempting to make a simple update query in VBA,  I can connect to the Quickbooks to read data but then the following error occurs when update method is attempted:

 Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Here's my code.

Const adOpenStatic = 3
Const adLockOptimistic = 3
 
Dim oConnection
Dim rs
Dim sMsg
Dim sConnectString
Dim sSQL
Dim row
Dim col
Dim FirstName As String
 
sConnectString = "DSN=Quickbooks Data;OLE DB Services=-2;"
sSQL = "SELECT * FROM Employee"
Set Connection = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

rs.cursortype = adOpenKeyset
Connection.Open sConnectString
rs.Open sSQL, Connection, adOpenStatic, adLockOptimistic
rs.Find "ListID ='80000041-1230761549'"
FirstName = rs!FirstName
MsgBox (FirstName)
rs("FirstName") = "Vickyokdfho"

rs.Update
MsgBox (FirstName)
rs.Close
Set rs = Nothing
Connection.Close
Set Connection = Nothing

thanks for any help.

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-05-06 09:21:48

ODBC cursor errors are common because QODBC only supports static or forward only type cursors. The work around is to always use ForwardOnly Cursors. For example with ADO keyset cursors we recommend:-

With rs
    .CursorType = CursorTypeEnum.adOpenForwardOnly
    .LockType = LockTypeEnum.adLockOptimistic
    .CursorLocation = CursorLocationEnum.adUseServer
End With

Try:

sConnectString = "DSN=Quickbooks Data;OLE DB Services=-2;"
sSQL = "SELECT * FROM Employee where ListID ='80000041-1230761549'"
Set Connection = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

rs.cursortype = adOpenForwardOnly
Connection.Open sConnectString
rs.Open sSQL, Connection, adOpenStatic, adLockOptimistic
FirstName = rs!FirstName
MsgBox (FirstName)
rs("FirstName") = "Vickyokdfho"

See: Can I get some examples of how to use QODBC via Visual Basic? for more.

 

  Top 
  Trevor 
  
 Group: Members 
 Posts: 4 
 Joined: 2008-05-06 
 Profile
 Posted : 2008-05-06 10:43:13

I inserted the code you suggested and I'm still receiving the same error message when the rs.update method is called.

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-05-06 14:55:30
Check the bottom of the QODBC Message log in the QODBC Setup Screen Messages Tab for the true error. 

  Top 
  Trevor 
  
 Group: Members 
 Posts: 4 
 Joined: 2008-05-06 
 Profile
 Posted : 2008-05-07 01:56:19

It appears that this error does not create an entry in the message in the log. The following entry is taken from the SDK messages log:

20080506.085133 I 2624 QBSDKProcessRequest Application named 'FLEXquarters QODBC' starting requests (process 4804).
20080506.085133 I 2624 SpecVersion Current version of qbXML in use: 6.0
20080506.085133 I 2624 QBSDKMsgSetHandler QUERY: List Delete
20080506.085133 I 2624 QBSDKMsgSetHandler Request 1 completed successfully.
20080506.085133 I 2624 MsgSetHandler Finished.
20080506.085133 I 2624 QBSDKProcessRequest Application named 'FLEXquarters QODBC' finishing requests (process 4804), ret = 0.
20080506.085136 I 4804 RequestProcessor Connection closed by app named 'FLEXquarters QODBC'
20080506.085136 I 4804 RequestProcessor ========== Ended Connection ==========

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to