Solved

#Error in query field

Posted on 2014-12-22
3
136 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 500 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 47

Expert Comment

by:Dale Fye (Access MVP)
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

773 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