[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

#Error in query field

I have a field in a query that is returning #Error.

The syntax I have for the field in the query designer is:  ConvertedSchedHrs: CDbl([SchedHrs])*24

The field SchedHrs syntax is SchedHrs: [LoadSchComplete]-[LoadSchStart]  and is a shorttime field.

LoadSchComplete and LoadSchStart have no format in the query but in the table they both are both Date/Time fields.

How can I get rid of the #Error result which is ultimately showing up on a report field also?
0
SteveL13
Asked:
SteveL13
1 Solution
 
Rey Obrero (Capricorn1)Commented:
try using the Nz() function here

SchedHrs:Nz([LoadSchComplete],0)-Nz([LoadSchStart],0)
0
 
Robert ShermanOwnerCommented:
Is the error in the "ConvertedSchedHrs" column or the "SchedHrs" column?
0
 
Dale FyeCommented:
What happened to using:

Format([LoadSchComplete]-[LoadSchStart], "hh:nn")

Personally, if you don't want to use that option, I would have used:

ConvertedSchedHours: IIF(IsNull([LoadSchComplete]), NULL, IIF(IsNull([LoadSchStart]), NULL, [LoadSchComplete] - [LoadSchStart])) * 24

This would return a NULL if either the Complete or Start field is NULL
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now