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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms recording values, but main form not

Status
Not open for further replies.

czarjosh

Technical User
Jul 14, 2002
79
US
So I have a main form where i register someone. In this form there is a subform where I can register someone as a guest. ALL of the data is stored in a table called Registration. In the Registration table there is a Long Integer Field call Roommate that looks up a person guest by their RecNumber. Here is my problem.

Let's use 1 example, Fran and Meredith. Fran is the main registrant and Meredith is her guest. Fran's RecNumber is 16 and Meredith's is 17.

Sor some when thef form is filled out. Fran has NO guest, but Meredith has Fran listed as a guest. So the form is recording information in teh exact opposite of what I would like.

I do not need Meredith to have a guest (because she would not have one) i just need Fran to have a guest a identified.
 
Are you setting a variable to indicate whether or not the record reflects a guest? You could, in the underlying table, create a Yes/No or other field to indicate a guest. Then in the form, the user signs up as normal & in the subform's OnEnter event (or in the 1st fields GotFocus event) set the value of the yes/no to -1 which indicates that this person is a guest. If you need to know a guest of whom, then add another field to record the 1st record's ID. To use your example:
Fran registers, her RecNumber is 16. When she switches to the subform, in the Name control she types Meredith, your code updates the guest field to -1 and the mainID to 16 without Fran doing anything. Then you can view or run a report creating 2 instances of your main table, joining RecNumber to MainID, one to many, and you'll get all your members with their guests listed. Hope this helped.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top