Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a new record for two subforms with one click

Status
Not open for further replies.

jabrony76

Technical User
Apr 23, 2001
125
US
Hi all,

Here's the dilema,

I have a main form which houses Demographic info on patients. On that Main Form is the first Subform "Admission Info" and on the Admission Info Subform there lives another sub-subform "Discharge Info". (all three linked by a common ID#) Unfortunately, this methodology is needed due to circumstances too painful and frustrating to go into...

Question is - Can I create a command button that will allow the user to create a new record for both the Admission Info Subform AND the Discharge Info Sub-Subform?

I have tried using a macro with two commands, one for the Admission Info Subform stating "GotoRecord - New" and another for the Discharge info stating the same. This does not work because when I open the Main Form and click on the command button the popup error box tells me that the form "Admission Info" isn't open and then halts me. Please help me if you can!!

If it helps, i'm using both 97 (at work) and 2000 (at home) and I don't know much about writing code so be gentle.

Thanks in advance,
Andy
 
Until you actually enter data into the first subform's new record, it doesn't actually exist as a "real" record. So, when you try to add the sub-subform new row, it doesn't recognise any associated subform record to link to.

You need to insert some intermediate rows in your macro to:
(1) add some valid information to your first subform's new row, and
(2) save the new row, and then create the new row in your sub-subform.

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top