Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RecordSet problem - Help!
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00630256
Message ID:
00630398
Views:
22
Make sure the connection is open Read/Write (read only is default)

oConn.Mode = adModeReadWrite


>I'm getting the error 'Recordset does not support updating'. Here's
>my code.
>
>My connection code is:
>
>
>
>sConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data _ Source=D:\Projects\Marketing\Data\3k.mdb;Persist Security Info = False"
>
>Set oConn = New ADODB.Connection
>oConn.Open sConnectString
>

>
>The error occurs when I run this (On the AddNew line):
>
>Set oDetails = OpenTable(oConn, "order_details")
>
>With oOrdDetRecs
>  .AddNew
>  !OrderId = iOrderId
>  !ProductId = cboParts(iRow).GetItemId()
>  !Quantity = txtQuantity(iRow).Text
>  !Price = Val(lblPrice(iRow).Caption)
>  !Subtotal = iQuantity * yPrice
>  .Update
>End With
>

>
>The OpenTable function is here:
>
>
>
>Public Function OpenTable(oConn As ADODB.Connection, sTableName As String) As ADODB.Recordset
>
>  ' Create a record set
>  Set oRecSet = New ADODB.Recordset
>
>  With oRecSet
>
>    ' Assign the record set properties
>    .ActiveConnection = oConn
>    .CursorType = adOpenKeyset
>    .LockType = adLockOptimistic
>    .CursorLocation = adUseServer
>
>    ' Open the record set
>    .Open sTableName
>
>  End With
>
>  ' Return the record set object
>  Set OpenTable = oRecSet
>
>End Function
>
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform