It's been a while since I worked on any Access queries !
The following returns #Error in the [Parts]/[Labour] calculated field:
SELECT [qryEstimatorStats-Dash].Estimator, [qryEstimatorStats-Dash].Parts, [qryEstimatorStats-Dash].Labour, [Parts]/[Labour] AS [Parts-Lab]
FROM [qryEstimatorStats-Dash];
Can some one refresh my memory :-)
Regards
#Error
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: #Error
Are Parts and Labour both number (or currency) fields?
Does it make a difference if you use
SELECT [qryEstimatorStats-Dash].Estimator, [qryEstimatorStats-Dash].Parts, [qryEstimatorStats-Dash].Labour, [qryEstimatorStats-Dash].[Parts]/[qryEstimatorStats-Dash].[Labour] AS [Parts-Lab]
FROM [qryEstimatorStats-Dash];
Does it make a difference if you use
SELECT [qryEstimatorStats-Dash].Estimator, [qryEstimatorStats-Dash].Parts, [qryEstimatorStats-Dash].Labour, [qryEstimatorStats-Dash].[Parts]/[qryEstimatorStats-Dash].[Labour] AS [Parts-Lab]
FROM [qryEstimatorStats-Dash];
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: #Error
They're both number Hans as far as I can see, your version doesn't work either.
Regards
Regards
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: #Error
Hmm - null (blank) values in Parts or Labour should result in null values in Parts-Lab, and zeros in Labour should result in #Div/0, not in #Error, so it's hard to tell what causes this.
Could you post a stripped-down and zipped copy of the database without sensitive information?
Could you post a stripped-down and zipped copy of the database without sensitive information?
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: #Error
Hi Hans
Th equery takes its parts from nested queries so probaby too cumbersome to send a demo. I'll check the queries from the bottom up and see where the problem lies. I'll come back and let you know how I get on.
Just thought this could have been an easy fix... nothings simple is it lol.
Regards
Th equery takes its parts from nested queries so probaby too cumbersome to send a demo. I'll check the queries from the bottom up and see where the problem lies. I'll come back and let you know how I get on.
Just thought this could have been an easy fix... nothings simple is it lol.
Regards
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: #Error
The SQL itself is OK. I'd start by opening qryEstimatorStats-Dash and inspecting the Parts and Labour columns for anomalies.
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: #Error
Cheers Hans
It might be easier to start afresh with the query and do away with the underlying ones.
Kind Regards
It might be easier to start afresh with the query and do away with the underlying ones.
Kind Regards
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: #Error
Hi Hans
It seems the parts and labour elements are "text" in the table design. As this table is used extensively I cannot change the property !
SELECT tblEST.Finished, SplitPart([EST_NME],1) AS Estimator, tblEST.STA, Val([PRT_CST]) AS Parts, Val([LAB_CST]) AS Labour, Val([parts]/[labour]) AS Parts_To_Labour
FROM tblEST
WHERE (((tblEST.STA)="F"));
The #Error only occurs when 0 divides into 0 ?
It seems the parts and labour elements are "text" in the table design. As this table is used extensively I cannot change the property !
SELECT tblEST.Finished, SplitPart([EST_NME],1) AS Estimator, tblEST.STA, Val([PRT_CST]) AS Parts, Val([LAB_CST]) AS Labour, Val([parts]/[labour]) AS Parts_To_Labour
FROM tblEST
WHERE (((tblEST.STA)="F"));
The #Error only occurs when 0 divides into 0 ?
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: #Error
Try
IIf(Val([Labour])=0,Null,Val([Parts])/Val([Labour])) AS Parts_To_Labour
IIf(Val([Labour])=0,Null,Val([Parts])/Val([Labour])) AS Parts_To_Labour
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 1728
- Joined: 25 Jan 2010, 08:34
- Location: Stoke on Trent - Staffordshire - England
Re: #Error
Thanks Hans.
I Modified slightly:
IIf(Val([Labour])=0,0,Val([Parts])/Val([Labour])) AS Parts_To_Labour
Instead of Null which serves the purpose better.
Regards
I Modified slightly:
IIf(Val([Labour])=0,0,Val([Parts])/Val([Labour])) AS Parts_To_Labour
Instead of Null which serves the purpose better.
Regards
Cheers ...
Dave.
Dave.
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands