Button on form fills text box on subform (1 Viewer)

adammitchell23

Registered User.
Local time
Today, 05:34
Joined
Oct 30, 2017
Messages
24
Hi all,

This should be relatively simple to do; I've Googled, and tried Allen Browne's suggestions, but I just can't get it to work and I don't know why:

I have a form [frmTransects] and a subform [sfTransects_Distance].

The form records details of a transect observing animals. The subform records details of animals seen on that transect, such as the number seen.

If no animals are seen on a transect, I still need a line on the subform to tell my analysis program that a transect was run, but no animals were seen. In this instance, the subform textbox [Cluster_Size] should be set to "0".

I have two buttons on the main form frmTransects with the label "Did you see any animals?" - users press btnYes if they did, the subform is enabled, and they enter the details of each animal seen.

If they saw none, they press btnNo - this button should fill the subform control [Cluster_Size] with "0" and close the main form, thus indicating to my analysis program that a transect was run but no animals seen, by leaving a blank line, with only [Cluster_Size] filled (with "0"). This is the way the analysis program works, so it has to be this way.

It's this last part I'm having issues with - could someone tell me how to get btnNo on the main form to populate [Cluster_Size] on the subform with "0" and then close the form?

Obviously the easiest way would be to get users to enter the 0 themselves, but I really don't trust them to do that...

Cheers,

Ad
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:34
Joined
Sep 21, 2011
Messages
14,287
Use an append query to the table that is the source for the subform ?
 

adammitchell23

Registered User.
Local time
Today, 05:34
Joined
Oct 30, 2017
Messages
24
OK, it turns out I was being a moron - I was referring to the subform by its name (ie. sfTransects_Distance) instead of as a subform of the main form (ie. Child11).

Thanks for the reply though, Gasman!
 

Users who are viewing this thread

Top Bottom