12-03-2018, 02:53 AM
|
#1
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Form Field Calculation Errors
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.
|
|
|
12-03-2018, 02:58 AM
|
#2
|
AWF VIP
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
|
Re: Form Field Calculation Errors
How are you setting the default 0 quantity ?
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
12-03-2018, 03:09 AM
|
#3
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Re: Form Field Calculation Errors
Hi Minty,
As the default value of the text box in the property sheet.
|
|
|
12-03-2018, 03:12 AM
|
#4
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Re: Form Field Calculation Errors
Interestingly you cannot set it in vba (me.textbox.value = 0) as this errors.
|
|
|
12-03-2018, 05:05 AM
|
#5
|
AWF VIP
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
|
Re: Form Field Calculation Errors
Are you using 0 or "0" ?
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
12-03-2018, 05:13 AM
|
#6
|
AWF VIP
Join Date: Jun 2003
Location: Richmond (Virginia that is!)
Posts: 6,320
Thanks: 11
Thanked 721 Times in 671 Posts
|
Re: Form Field Calculation Errors
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)>
__________________
The Devil's in the Details! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(All code solutions tested in Access 2003/2007, before posting, unless otherwise noted.)
|
|
|
12-03-2018, 06:56 AM
|
#7
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Re: Form Field Calculation Errors
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.
|
|
|
12-03-2018, 07:15 AM
|
#8
|
AWF VIP
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
|
Re: Form Field Calculation Errors
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.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
12-03-2018, 07:25 AM
|
#9
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Re: Form Field Calculation Errors
The vba setting of this is in the load event and that triggers but gets it wrong randomly.
|
|
|
12-04-2018, 04:14 AM
|
#10
|
Still Clueless
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
|
Re: Form Field Calculation Errors
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
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
All times are GMT -8. The time now is 02:21 PM.
|
|