0
votes

I have a parent form containing a subform with child information Apart from this problem, everything works ok so the master/child links are ok. I can traverse the parent form and the children obediently follow.

When I add a new parent using the record selector (either by pressing the star, or by moving beyond the last record) both the parent and subform clear as I would expect. The instant that I start entering data into the parent form the child subform refreshes with the data from the last record viewed when I hit the star for a new record.

Thus:

  1. Viewing parent 'SMITH' and child 'FREDDY'
  2. Press star on the record selector for new record (or move beyond the last record)
  3. Fields on both parent and child forms cleared
  4. Start entering new parent information
  5. Child form is refreshed with information for 'FREDDY'

If I use the record selector to move back and then forward again the SMITH/FREDDY records are unaffected and the new record contains the parent info that I entered so far with the child all clear and I can happily carry on entering the correct information.

(URRRRGGGHH - I have no hair left!!) Any suggestions would be greatly appreciated.

1
If there is no code involved in this issue, then it must be a design problem. This would require viewing db to analyze issue. Question is therefore not really appropriate for SO.June7
Question is clear but I've never seen that. Unfortunately, see previous comment.wazz
And sometimes weirdness is due to corruption. Is this issue reproduced if you build new form objects?June7

1 Answers

0
votes

Thank you for your comments.

I have gone back through my saved dbs and found the problem appeared when I introduced subforms.

This project started as a one where the user would only want to see a single record at a time. There is no association between records. As happens with users, when they see the possibilities, they start asking for more (but for COVID I could have met up and thrashed this out prior to starting but hey ho we are where we are).

So a single record turned into a record for client and optionally their partner to appear on the same screen so that it would be easy for them to compare info. At first, to check out their requirement, I just added fields for the partner to the table and the single form showed common information at the top and then client and partner information side by side. So far so good.

I then split the table into the common information such as address and the individual information. Thus I had a master record with 1 or 2 child records and I re-arranged my existing test data into the two tables. I now had a master form with 2 identical subforms, one showing info for the client and one for the partner.

I used 2 hidden fields on the master form to control the record for each subform which worked really well. (This was a suggestion I found on the web and would give the link her but I can’t now find it). It was only when I started adding records that I saw the problem.

Having spent hours trying to resolve this I have resorted to the following get round:

When the OnCurrent event is fired I check for it being a new record. If so then I physically add a master and 2 child records to the database and link them. I then requery and position on the new master/children records. This works fine apart from the user seeing the first record in the recordset flash up on the screen as a result of the requery before the empty new record is displayed following the move to the new master.

So – I have a get round. Thanks again for your comments and hope the above may be of use to somebody.