I can't figure this out

Nicolette

Always Learning
Local time
Today, 13:44
Joined
Jun 26, 2010
Messages
178
I have spent much of today trying to create a subtotal in a subform then displaying it in my main form I have tried almost every suggestion on here and I keep getting a name error on the main form... I know the reference is spelled correctly

in my subform I have in the form footer a textbox with the following in the control source:
=Sum([OrderQty]*[OrderPrice])

in the main form I have the a textbox with the following in the control source:
=[Forms]![frmCreateInvoiceSUB]![OrderSubtotal]

I took this directly from the microsoft site so I don't know why it isn't working....
 
Have you tried:

=[Forms]![frmCreateInvoiceSUB].[Form]![OrderSubtotal]

Pay close attention to the dot and bang.
 
really.... that is interesting because I used the expression builder for that part.... I would have thought that the builder would have gotten it right....
 
really.... that is interesting because I used the expression builder for that part.... I would have thought that the builder would have gotten it right....

It should have (and my builder does it correctly).
 
Hum... I changed it to match your post and that didn't work
 
Shouldn't it be forms![mainformname]![subformname].form![controlname]?
 
Nicolette,

I think Bob has made a typo in his reply to you. And I think your expression is also incorrect. I am not sure how the expression builder is handling this. But if this is the name of your subform:
frmCreateInvoiceSUB
... and this is the name of the control on the subform that you want to reference on the main form:
OrderSubtotal
... then the expression in the Control Source of an unbound control on the main form is:
=[frmCreateInvoiceSUB]![OrderSubtotal]

That's it. This will work, I promise. Putting the "[Forms]!" bit in there doesn't make sense.

It would be possible to fully reference like this:
=[Forms]![NameOfYourMainForm]![frmCreateInvoiceSUB]![OrderSubtotal]
... or, as Bob would probably prefer it:
=[Forms]![NameOfYourMainForm]![frmCreateInvoiceSUB].[Form]![OrderSubtotal]
... either is fine, but unduly circuitous. Just do it like this:
=[frmCreateInvoiceSUB]![OrderSubtotal]
 
Cool, didn't know you could do it like that Steve, every day's a school day!

I found this useful when I was learning about absolute references:
 

Attachments

That's the kiddie, wondered where I got it from all those months ago
 
James and vbaInet,

Yes, this article is talking about managing this stuff in code. Nicolette's scenario concerns a Control Source expression - nothing to do with code, and a completely different kettle of fish.
 
That's correct Steve. I was only referring to James' post. The OP might find it useful someday.
 
=[frmCreateInvoiceSUB]![OrderSubtotal]
Nope it still gives me a #Name? error
 
can anyone offer any suggestions as to why nothing seems to be working...
 

Users who are viewing this thread

Back
Top Bottom