Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

#Error in query field

Posted on 2014-12-22
3
Medium Priority
?
158 Views
Last Modified: 2014-12-22
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
Comment
Question by:SteveL13
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40512910
try using the Nz() function here

SchedHrs:Nz([LoadSchComplete],0)-Nz([LoadSchStart],0)
0
 
LVL 7

Expert Comment

by:Robert Sherman
ID: 40512914
Is the error in the "ConvertedSchedHrs" column or the "SchedHrs" column?
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 40513053
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question