Multiple entries on one form

Applefritter

Registered User.
Local time
Yesterday, 22:13
Joined
Jul 22, 2004
Messages
14
Help for the helpless once again.
I have two tables, Log and Sample. The Sample table will only have 2 fields (SampleID and Sample). Its a many to many relationship so I created a simple junction table to link them. On my main Log form (frmLog) I would like one of my yes/no option buttons to open up a subform when "yes" is selected for additional data entry. I assume this should be a simple "On Click" or "On Key Down" event, correct?

How do you create a subform that may or may not have multiple entries? Can I have multiple "Sample" fields on one form or do I have to create a button to add another record? I haven't been able to figure out how to create this simple subform.
Regards,
Sandra
 
You could check you Yes/No in the OnClick event then make your sub form visible. You would also need to test it in the OnCurrent event of the form to determine whether or not the sub form needs to be visible or not.

You might also want to consider locking the control once it has been clicked to "Yes", to ensure that it is not inadvertently clicked to "No" whilst there are samples. You would also need to test and deal with this in the forms OnCurrent event.

If the sub form is set up correctly you could have any number of samples. You will then need to decide if you wish to show it as a continuous form (that would be my preference) or as a single form with navigation buttons.
 
Setting up the subform as a continuous form worked out great.

One question though. The "On Click" command is not available on the individual yes/no option button. It's only available on the option group. What would be the code I would need to build an expression to get a blank subform to open up if "Yes" is selected?
 
John appears to be offline. Typically you would use the click event of the frame, test the frame's value and set the subform's visibility appropriately.
 
Please excuse my ignorance but what exactly does testing the frame value mean?
 
Each item within the option group has an "Option Value" property. When you test the frame, it will have the value of the selected option. If you had 1 for yes and 2 for no, your test might look like:

If Me.FrameName = 1 Then
 

Users who are viewing this thread

Back
Top Bottom