Form Field Calculation Errors (1 Viewer)

Tieval

Still Clueless
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
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

  • type.jpg
    type.jpg
    30.9 KB · Views: 45

Minty

AWF VIP
Local time
Today, 13:02
Joined
Jul 26, 2013
Messages
10,354
How are you setting the default 0 quantity ?
 

Tieval

Still Clueless
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
Hi Minty,

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

Tieval

Still Clueless
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
Interestingly you cannot set it in vba (me.textbox.value = 0) as this errors.
 

missinglinq

AWF VIP
Local time
Today, 09:02
Joined
Jun 20, 2003
Messages
6,423
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
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
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

  • type2.jpg
    type2.jpg
    44.3 KB · Views: 36

Minty

AWF VIP
Local time
Today, 13:02
Joined
Jul 26, 2013
Messages
10,354
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
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
The vba setting of this is in the load event and that triggers but gets it wrong randomly.
 

Tieval

Still Clueless
Local time
Today, 13:02
Joined
Jun 26, 2015
Messages
475
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

Top Bottom