Show calculation from main form in sub form

T

tboyce

I have a field on my main form. I have a calculated sum on my sub form called
DaysLeft which is calculating how many days used so far. I would like to
subtract the figure on the main form from that on the sub form and show the
result back on the sub form. I have used the following formula but it reports
an error

=[Form]![StaffMembers]![Entitlement]-Me![DaysLeft]

StaffMembers being my main form & DaysUsed being the calculation field on
the sub form. There are plenty of examples showing calculations from sub to
main but not the other way round. Can anyone help please
 
J

John W. Vinson

I have a field on my main form. I have a calculated sum on my sub form called
DaysLeft which is calculating how many days used so far. I would like to
subtract the figure on the main form from that on the sub form and show the
result back on the sub form. I have used the following formula but it reports
an error

=[Form]![StaffMembers]![Entitlement]-Me![DaysLeft]

StaffMembers being my main form & DaysUsed being the calculation field on
the sub form. There are plenty of examples showing calculations from sub to
main but not the other way round. Can anyone help please

Either use

[Forms]![StaffMembers]![Entitlement] - [DaysLeft]

or

Parent.[Entitlement] - [DaysLeft]

It's Forms! rather than Form!, and you can only use the Me! shortcut in VBA
code.
 
T

tboyce

Thank you for that John both of these worked straight away

John W. Vinson said:
I have a field on my main form. I have a calculated sum on my sub form called
DaysLeft which is calculating how many days used so far. I would like to
subtract the figure on the main form from that on the sub form and show the
result back on the sub form. I have used the following formula but it reports
an error

=[Form]![StaffMembers]![Entitlement]-Me![DaysLeft]

StaffMembers being my main form & DaysUsed being the calculation field on
the sub form. There are plenty of examples showing calculations from sub to
main but not the other way round. Can anyone help please

Either use

[Forms]![StaffMembers]![Entitlement] - [DaysLeft]

or

Parent.[Entitlement] - [DaysLeft]

It's Forms! rather than Form!, and you can only use the Me! shortcut in VBA
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top