Update or CancelUpdate without Addnew or Edit

S

Synergy

The following code snippet is giving me a problem since I linked to SQL
Server tables. The Update method bombs giving me the error
Update or CancelUpdate without AddNew or Edit.

I stepped through the code and it is addressing the line rsMe.AddNew

This works fine when linked to Access Tables. Thanks for any help in
resolving this issue.


'Update Rule Ht specifications related to this order
Dim rsData As Recordset 'Data Source
Dim rsMe As Recordset
Dim fld As Field
Set rsData = [RuleNoCounter].Form.RecordsetClone
Set rsMe = [RuleNoCounter2].Form.RecordsetClone
On Error Resume Next
rsData.MoveFirst
rsMe.MoveFirst
'Stop
If rsMe.RecordCount = 0 Then 'Add new record if needed
rsMe.AddNew
Else
'rsMe.Edit Editing omitted to allow manual changes
End If
For Each fld In rsMe.Fields
rsMe(fld.Name) = rsData(fld.Name)
Next fld
rsMe![OrdID] = Parent.[OrdID] 'Update Child link
On Error GoTo error_Section 'Temp
rsMe.Update
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top