Calculated field does not display.

94Sport5sp

Registered User.
Local time
Today, 06:35
Joined
May 23, 2012
Messages
115
Hi:

On a form I have designed I have an unbound field which calculates a result from various table fields. The bound fields and the one unbound field are all set to visible = false until the user has entered some information. Using vba, when the conditions has been met then I set all bound fields and the one unbound field to visible = true. All works well except the unbound field does not display the calculated value. The field becomes visible but the values are not. What am I missing?

As a test, I set the unbound field to visible and the amounts display properly. When the vba code sets the unbound field to visible then the values disappear. If I break into the code then the values are again visible. Not sure what to do next.

Thanks
 
What is the control source for that calculated control? (it is a control not a field - fields are in tables and queries and controls are on forms and reports and can be bound to a field or to an expression)
 
Hi:

The control is not bound to the table and the source is a formula using controls which are bound to a table.

Thanks
 
Hi:

Just to be clear, the formula calculates properly and displays properly. It is only when I set the control to not visible and then use VBA code to set the control to visible that I cannot see the results of the calculations. When my VBA code sets .visible= true the control displays but the values do not. If I break into the code then the values display.

The formula is = [Visa] + [MC] + [Amex] + [DebitCrd] so nothing fancy.

Thanks
 
The formula should be changed to this:

= Nz([Visa],0) + Nz([MC],0) + Nz([Amex],0) + Nz([DebitCrd],0)

If you have any nulls then it would return a null. So the NZ function handles those.
 
Hi:

Thanks for the tip, and yes, that would handle any nulls which may creep into the data. That change however, still does not address the problem I am having.

Thanks
 
So in the after update event of each bound control you can put

Me.recalc

Which might help. If not then post a copy so we can see.
 
Hi:

The bound controls are not causing me a problem. I can make them visible and the values display as expected. It is the unbound control which is not displaying the value and only if I use code to set the unbound control to visible.

So if I start with the unbound control visible then the values are displayed. If I let my code set the unbound control (me.TotDep.Visible = true) then the control remains visible but the values disappear. Why would making a visible control (or in my original case a non visible control) visible cause the value to not be displayed? Is access considering this a new display when I make the visible control visible?

Thanks
 

Users who are viewing this thread

Back
Top Bottom