Update main form from sub form automatically

Hazo69

New member
Local time
Today, 08:20
Joined
Apr 21, 2008
Messages
7
I have a main form and 2 sub forms problem is that i would like my sub forms when sor no is selected or typed in to update the Painters YES or NO field to YES when these sub forms have no data entered into them if they stay at NO

Can anyone help

Many thanks

Hazo69
 

Attachments

  • copy of ten.jpg
    copy of ten.jpg
    93.8 KB · Views: 195
In the AfterUpdate event of the subform, update the appropriate field. You will need the same code in the main form's Current event so that the y/n fields are correctly set when you move to a different existing record.
 
if a subform setting is affecting the mainform there may be something wrong - since subforms by definition are functionally dependent on the main form, there shouldnt be anything in the subform that would change something in the mainform

ie if you have a 1 to many relationship, how can something in the many side affect the one side?

its hard to see exactly what is going on though on your form - do you mean you just want the yes no box to say no, if there are no records IN the sub forms (which is not quite the same thing, as updating the main form). BUT if you are holding a separate yes/no flag in the main record to indicate whether there are any sub records, then this is un-normalized and will be awkward to maintain, as you are finding out.
 
Last edited:
the purpose of these boxes is to give an indication as to which tab contains data. I forgot to remind the poster that they should be unbound. The code in the current event will calculate them each time a new record is viewed.

I have a similar situation in one of my applications and rather than using yes/no boxes, I actuall change the tab name to have two leading ** when the tab's subform contains data.
 

Users who are viewing this thread

Back
Top Bottom