Results 1 to 2 of 2

Thread: [RESOLVED] How to link form recordset with its subform recordset

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    131

    Resolved [RESOLVED] How to link form recordset with its subform recordset

    Hi, I have a form with some controls that perform actions on the current record such as "Create New", "Delete", "Move", etc. I also have a subform in this form that contains all the records I am working with (in continuous form view). Because the user can click on the record they want to work with and perform actions on, I want to be able to link the recordset of the subform and form. This will enable the user to click on the record in the subform then click an action button in the form and the action button will perform the action on the selected record in the subform.

    I had this working by using this code in the Form_Open event:

    VB Code:
    1. Private Sub Form_Open(Cancel As Integer)
    2.  Set [Form].Recordset = [Subform].Recordset
    3. End Sub

    However, this would give me the 3020 run time error when changing the value of a control in the subform. The error is "Error 3020 - Update or CancelUpdate without AddNew or Edit." Why am I getting this error only when they are linked. Is there some way to link the form and subform without getting this error?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    131

    [Resolved]: How to link form recordset with its subform recordset

    I figured it out... I used the Form_Current event to synchronize the records using DoCmd.GoToRecord... here's the code:

    VB Code:
    1. DoCmd.GoToRecord acDataForm, "Form", acGoTo, [Form_Subform].CurrentRecord

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width