Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-03-2018, 02:53 AM   #1
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
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.
Attached Images
File Type: jpg type.jpg (30.9 KB, 19 views)

Tieval is offline   Reply With Quote
Old 12-03-2018, 02:58 AM   #2
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
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.
Minty is offline   Reply With Quote
Old 12-03-2018, 03:09 AM   #3
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
Re: Form Field Calculation Errors

Hi Minty,

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

Tieval is offline   Reply With Quote
Old 12-03-2018, 03:12 AM   #4
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
Re: Form Field Calculation Errors

Interestingly you cannot set it in vba (me.textbox.value = 0) as this errors.
Tieval is offline   Reply With Quote
Old 12-03-2018, 05:05 AM   #5
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
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.
Minty is offline   Reply With Quote
Old 12-03-2018, 05:13 AM   #6
missinglinq
AWF VIP
 
missinglinq's Avatar
 
Join Date: Jun 2003
Location: Richmond (Virginia that is!)
Posts: 6,320
Thanks: 11
Thanked 721 Times in 671 Posts
missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light missinglinq is a glorious beacon of light
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.)
missinglinq is offline   Reply With Quote
Old 12-03-2018, 06:56 AM   #7
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
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.
Attached Images
File Type: jpg type2.jpg (44.3 KB, 11 views)

Tieval is offline   Reply With Quote
Old 12-03-2018, 07:15 AM   #8
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,439
Thanks: 166
Thanked 1,738 Times in 1,707 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
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.
Minty is offline   Reply With Quote
Old 12-03-2018, 07:25 AM   #9
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
Re: Form Field Calculation Errors

The vba setting of this is in the load event and that triggers but gets it wrong randomly.
Tieval is offline   Reply With Quote
Old 12-04-2018, 04:14 AM   #10
Tieval
Still Clueless
 
Join Date: Jun 2015
Location: UK
Posts: 429
Thanks: 57
Thanked 42 Times in 42 Posts
Tieval is on a distinguished road
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

Tieval is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Report errors on unbound text field from form jstordahl Reports 3 11-29-2012 08:36 AM
Append query calculation errors jamescsmith.128 Queries 1 08-09-2011 09:12 PM
Calculation field in Form AbeA Forms 4 09-18-2007 07:28 AM
form field calculation piet123 Forms 3 06-02-2004 01:38 AM
[SOLVED] Can I do a calculation on a field in a form? julia Forms 1 03-01-2000 04:37 PM




All times are GMT -8. The time now is 02:21 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World