Error with no value

J

Jason

I am trying to pull the value of the subform onto the main form which works
OK when there are records on the subform. But, if no records I get:

Run-time error '-2147352567 (80020009)':
You entered an expression that has no value.
The expression may refer to an object that has no value, such as a form, or
a label control.

sub Form_OnCurrent:
msgbox FormNameSubform!TotalSum
end sub

control of text field:
=FormNameSubform!TotalSum

the text field shows #error which is why i entered the test onCurrent event.
I haven't had this error before but I suspect that is because those sub
forms have allowadditions = true wheras this subform has allowadditions =
false.
 
J

Jason

So I would use Formhasdata("FormName!FormNameSubform") to call the function.

I think it is easier to stick with what I have come up with after posting
question:
created query where the SQL is similar to that of the subform then all I
need is:
=nz(Dsum("Value","SubFormQuery","QueryID = " & ID))
 

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