General information
Category:
Database DAO/RDO/ODBC/ADO
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only