Data not saving

  • Thread starter Thread starter Geoff
  • Start date Start date
G

Geoff

I have a subform that has controls with calculations in, using a value in
the main form. When I change the value in the main form I need the
calculations in the subform to update straight away.

I also have fields in the subform with calculations done on them ALSO in the
subform, and they update themselves because I have this code in the 'after
update' for each field that the calculation depends on:

DoCmd.RunCommand acCmdSaveRecord

The calculations then update as soon as I press enter to enter any values I
input. I can't make the same thing work when moving from the main form to
subform. I've tried putting that code in various places but I'm not getting
anywhere.

Any ideas please?

Thanks,
Geoff.
 
You may just need to reissue a Requery on the subform using the After Update
event on the field that changes.
When you reference a subform control you must not only specific the mainform
name, you also specify the subform name. Such as: Forms![Orders]![Orders
Subform]![Quantity]
 
GVaught said:
You may just need to reissue a Requery on the subform using the After Update
event on the field that changes.
When you reference a subform control you must not only specific the mainform
name, you also specify the subform name. Such as: Forms![Orders]![Orders
Subform]![Quantity]


Thanks for that. The other problem I've got is that I do a check on whether
there are any records in the subform or not, and it performs a function
based on that. If I was to save the main form record like I'm planning, then
I guess the first subform record would also be saved, and that would mess up
the 'no records' check. Maybe it wouldn't be saved at that point though-I
need to do some testing. Or better still, I should stop trying to automate
everything and just type the odd thing in myself! Would that make life
simpler? :)

Thanks for your reply,
Geoff.
 
Back
Top