I just converted a piece of code from DAO to ADO and now updating the recordset does not work. I am getting the following error message:
"Runtime Error 3251: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."
I simply have a main form with two subforms. Each subform is based on a table. When I double click on the "DHole" field of the first subform, it saves the data in that field to a field on the main form, named "txtAddDHole". Then I want it to take that value and add it to the second subform's control source, which is the other table. I had this working great with DAO, but I am new to ADO, so I'm sure I am missing something in my code. Can anyone help me with this? MUCH APPRECIATED!
</code>
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "tblPrintMultipleDHoles", cnn
'this code just takes the value of the field the user double clicks on and
' displays it in the "txtAddDHole" field on the main form.
[Forms]![frmPrintMultipleRecords]![txtAddDHole] = [Forms]![frmPrintMultipleRecords]![frmSubDHOLE]![txtDHOLE]
'now I want the value of that field to be added to the table that holds all the DHole values the user has double-clicked on. Simply populate this table and display the results on the subform.
With rst
.AddNew
!DHOLE = [Forms]![frmPrintMultipleRecords]![txtAddDHole]
.Update
End With
<code/>
THANKS A BUNCH FOR ANY HELP.
"Runtime Error 3251: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."
I simply have a main form with two subforms. Each subform is based on a table. When I double click on the "DHole" field of the first subform, it saves the data in that field to a field on the main form, named "txtAddDHole". Then I want it to take that value and add it to the second subform's control source, which is the other table. I had this working great with DAO, but I am new to ADO, so I'm sure I am missing something in my code. Can anyone help me with this? MUCH APPRECIATED!
</code>
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "tblPrintMultipleDHoles", cnn
'this code just takes the value of the field the user double clicks on and
' displays it in the "txtAddDHole" field on the main form.
[Forms]![frmPrintMultipleRecords]![txtAddDHole] = [Forms]![frmPrintMultipleRecords]![frmSubDHOLE]![txtDHOLE]
'now I want the value of that field to be added to the table that holds all the DHole values the user has double-clicked on. Simply populate this table and display the results on the subform.
With rst
.AddNew
!DHOLE = [Forms]![frmPrintMultipleRecords]![txtAddDHole]
.Update
End With
<code/>
THANKS A BUNCH FOR ANY HELP.