How to loop through subform records, update the 2nd row in a subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gavin Sequeira
    New Member
    • Aug 2010
    • 1

    #1

    How to loop through subform records, update the 2nd row in a subform

    Hi. I have a Main form with a Subform. My Main form generates an ID and some info is passed to the subform alongwith the ID. Lets say some changes are made to the mainform, this info is then added to the subform as a new record with the same ID (as in the main form) i.e saved as a 2nd record in my subform and will show under the main forms ID as 2 records. There are times when I have to generate the same values of the main form and capture the data as a new record in the mainform. I am able to do this for the main form, but I can only update the first record withtin the subform. inspite of using loops, movenext etc etc, I am unable to move to the next record to update it with the Main form ID. How do I copy the data in the subform and add it as a new record in the subform with the new ID generated in my Main form. Am i doing sumthing wrong in the loop? I need the solution ASAP and hence have posted this problem here for the first time as I cannot figure this bit of code...I would say I am an intermediate Access user with fair bit of access knowledge..

    btw, pls also note that after the 1st record is updated, I get a write conflict as well...

    Any help to resolve these 2 issues (which I believe are interlinked) would be appreciated.
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    #2
    I do not really understand what you are trying to say.
    You did not post any code, though you mention that you did tried something.
    You are trying to:
    1. Copy some info from parent form into a new record in subform?
    2. Change/Edit values for all records in datasheet/subform from Main Form?

    Can you make your question more clearer.?

    You maight have a look at this thread Inserting values into subform datasheet from main form.. It's similar to what your are trying to say.
    I found the solution myself

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      I'm not clear what you're trying to achieve Gavin, but I would say that any design where a subform is bound to the same data as the main form is not recommended and is very likely to leave you facing such data contention issues. Fundamentally and logically it is an illogical setup.

      I would give consideration to exactly what you are hoping to achieve here and try to come up with a more appropriate design for it.

      Comment

      Working...