-----Original Message-----
It should have worked so it might be the names of your forms or the name of
your control. also what it the error you are getting or what is not working?
Here are some examples:
There are a number of ways to wright this code.
If you look at the vb explorer you see the name of your form look something
like this: Form_Form1
i can't remember why they do this but that is there naming convention
you can use that exact name or you can use your short version by putting []
around the name. This is also necessary if you have spaces in the name.
use access names:
Form_Form1!Text0 = "cool"
use your short names (Recommended):
[Forms]![Form1]![Text0] = "cool2"
you can also use the "." to access the properties of the form or controls.
Form_Form1.Text0.Value = "cool"
[Forms]![Form1]![Text0].Value = "cool2"
The .value is the default property, so if you don't use it VB figuers this
out and passes your data to that property like in the first 2 examples
You can also do combinations of syntax which is why it gets so confusing for
some people.
[Forms]!Form1!Text0 = "cool2"
[Forms]![Form1]![Text0] = "cool3"
[Forms]![Form1]!Text0.Value = "cool4"
All of the above examples were for accessing the main form from the subform
Also if you want to reference the form u are currently in the the me. is
usefull
me.Text0.Value = "to cool"
if you want to access the subform form the main form you can do something
like this:
[Form2].Form![Text1] = 2
[Form2].[Form]![Text1] = 3
Me.[Form2]![Text1].Value = 4
Your code was this:
forms!MainForm.RunningTotal= curTotal
if i were to use my example then it would look like this:
Forms!Form1.Text0 = curTotal
Also this code should be in the subform
i hope this helps
Good Luck!
Annie said:
Thanks for the reply. I think I need a bit of
clarification because I couldn't make it work.
I placed RunningTotal field on MainForm. Then in the VB
code for the subform (where I calculated curTotal)I put
in:
forms!MainForm.RunningTotal= curTotal
On RunningTotal do I need a control source? I tried
=curTotal but that didn't work. Somehow I missing the
actual link between RunningTotal(field) on the MainForm
and curTotal (VB calc on the subform). Sorry. Thanks
for the additional help! Annie
.