[SOLVED] Form Field Calculation Errors (1 Viewer)

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
Hi,

I have some form fields which a calculation is based on when a form is loaded, unfortunately it works randomly.

As per the attached examples, the consultancy rate (unbound) has a quantity (defaulted to zero), the next box is an hourly rate (looked up from a table) and the third box is the quantity x the rate. When the form loads this third value (or one or more of a couple of similar examples) frequently goes to #Type!

The hourly rate always loads and displays OK and I find that if I click in the quantity box, type zero again and tab out it all goes correct.

Any clues would be welcomed.
 

Attachments

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
Hi Minty,

As the default value of the text box in the property sheet.
 

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
Interestingly you cannot set it in vba (me.textbox.value = 0) as this errors.
 

missinglinq

AWF VIP
Joined
Jun 20, 2003
Messages
6,323
Don't really understand how you can use an Unbound value (Consultancy Rate) as part of an expression to get another Unbound Value (whatever the sometimes errant Control is called) on what has to be a Continuous Form (going by your attached image.) The rate will always be the same for all Records (being the Consultancy Rate for the Current Record.)

How/where are you doing the calculations when the Form Loads?

Linq ;0)>
 

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
Hi Missinglinq,
It is not a continuous form, Just similar items stacked(as attached).

It is used as a calculator so a quantity of hours (default value zero) can be applied to the hourly rate (controlled in a table) and calculated as a cost.

Minty,
The default value is 0 (not "0"), I can now set it in vba as me.textbox = 0 (no .value) but this makes no difference.
 

Attachments

Minty

AWF VIP
Joined
Jul 26, 2013
Messages
6,485
Setting it in VBA won't trigger any event to fire, you'd need to issue a requery on the target calculation box to take account of the changed value in any of the source controls.
 

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
The vba setting of this is in the load event and that triggers but gets it wrong randomly.
 

Tieval

Still Clueless
Joined
Jun 26, 2015
Messages
429
After much head scratching, this seems to be a network issue, I am thinking that the maths is done on data not yet received occasionally:mad:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top