Subform Refrence Problem

Keith

Registered User.
Local time
Today, 08:14
Joined
May 21, 2000
Messages
129
I have a form frmUpdateSubs with a subform frmSubTransTemp. I have a control Running Total on the main form with a control source of
Code:
=Nz([Forms]![frmUpdateSubs]![frmSubTransTemp]![txtSum],0)
Every thing works ok when I open frmUpdateSubs.
I have a main form frmMain with an option group 'Menu Options' and a control 'DisplayPanel'. I have a select case function for menu options that selects the source object of DisplayPanel. I have added a button to the option group to make the DisplayPanel.sourceObject = "frmUpdateSubs" When I click the button frmUpdateSubs opens but I get an error #Name? in Running Total.
I have tried all the combinations for reference in this link with no success. Could someone please point me in the right direction.
 
Have you tried requerying the calculated field once the sub is loaded?
 
Hi JD
Problem still exists
Regards
Keith
 
What is txtsum - is that a bound field on your subform or is it calculated?
 
Try a Me.Recalc after the sub has been loaded.
Just wondering though once the sub is loaded does txtsum have a value in it?

If not you may want something like this:
=IIf(IsNumeric([Forms]![frmUpdateSubs]![frmSubTransTemp]![txtSum]),Forms]![frmUpdateSubs]![frmSubTransTemp]![txtSum],0)
 
There shouldn't be a need to Refresh or Recalc for this kind of thing. Try this:

Code:
=(frmSubTransTemp.Form!txtSum)

Linq ;0)>
 
You're right that the Recalc and Requery may not be needed - if the form is set up as expected - but what you have written is no different to what Keith originally put so I don't think it will help.

The following 2 lines are essentially doing the same thing:
Code:
=Nz([Forms]![frmUpdateSubs]![frmSubTransTemp]![txtSum],0)
Code:
=(frmSubTransTemp.Form!txtSum)

Keith,
Are you sure the names of the forms and control are correct?
 
The point was to see if the code I provided works. If it does, your question

Keith said:
Are you sure the names of the forms and control are correct?

would be answered. The problem with the OP's code, I suspect, is the Square Brackets around all of the components:

Code:
=Nz([B][[/B]Forms[B]][/B]![B][[/B]frmUpdateSubs[B]][/B]![B][[/B]frmSubTransTemp[B]][/B]![txtSum],0)
In this context I believe Access assumes that they signify Control Names which, of course, they don't in the case of Forms, frmUpdateSubs and frmSubTransTemp.

Linq ;0)>
 
There shouldn't be a need to Refresh or Recalc for this kind of thing. Try this:

Code:
=(frmSubTransTemp.Form!txtSum)

Linq ;0)>
Thanks, that worked. Thank you also JD for your time.
 
This must be a version thing as the exact code Keith is using works for me in Access 2010.

Anyway, kudos to you Linq.
 

Users who are viewing this thread

Back
Top Bottom