By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,967 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,967 IT Pros & Developers. It's quick & easy.

How to assign value of unbound field to a bound field in a form?

P: 33
Hi,

I am using MS Access 2007/Vista

I have a field, ProductCost in the subform. i need to find the total of ProductCost and assign it to a field, Total, in the Main Form .

I read an article about how to find Sum from a subform field.
based on that, i stored the total value in an unbound field.

i dont know how to assign the value from the unbound field to a bound field , Total, in the main form.


can anyone help me in this regard,?

thanks

Kathy
Dec 11 '07 #1
Share this Question
Share on Google+
3 Replies


100+
P: 167
Hi,

I am using MS Access 2007/Vista

I have a field, ProductCost in the subform. i need to find the total of ProductCost and assign it to a field, Total, in the Main Form .

I read an article about how to find Sum from a subform field.
based on that, i stored the total value in an unbound field.

i dont know how to assign the value from the unbound field to a bound field , Total, in the main form.
Hi there!
In subform's footer put an unbount control named SumProductCost. It's source property should be: =Sum(ProductCost)
...If I understood correctly you allready came this far.

To show this total on the Main form put an unbound control named MainTotal in Main form's detail or footer section (if it's gonna be visible).

In MainTotal's source property put: =Me!SubFormName.Form.SumProductCost

I'll be here if you have more questions. Also you might try to read help in MSAccess, it's full of advices like this :-)

h.
Dec 11 '07 #2

P: 33
thanks for your reply.

I can get the value in the main form unbound field.

but i dunno how to store that value in to a bound field in a table...

for example,

i used the suggestion you gave me and i created an unbound field MainTotal
it works like a charm.

now, i wanted to assign the value in MainTotal unbound field into a field, TOTAL, in the main table.

is it possible to acheive this???

thanks in advance.

luv,
Kathy
Dec 12 '07 #3

100+
P: 167
hey Kathy

Usually calculated values are not supposed to be stored in the tables because they can be allways recalculated. Anyway, if you wanna store that walue in the TOTAL field on your Main Form just add a code like this in your Sub Form's after update event:

Expand|Select|Wrap|Line Numbers
  1. Me.Recalc
  2. Me.Parent.TOTAL = Me.Parent.MainTotal
After this Main Form will be in editing mode, and changes will not yet be saved so you can discard changes if you want.

Best,
h.
Dec 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.