none
The provider could not determine the Object value RRS feed

  • Question

  • I have a query to a table in a Access database that if I include the following field in the Select statement I get the error mentioned in the subject.

    IIf(IsNull(P.WORKING_HOURS_PYEAR) = -1 or 52 > P.WORKING_HOURS_PYEAR,
        CStr(P.WORKING_HOURS_PYEAR),
        CStr(Round(P.WORKING_HOURS_PYEAR / 52.0 / P.WORKING_DAYS_PWEEK, 3))) as WORKING_HOURS_PDAY

    Running the statement directly on Access doesn't cause a problem and the data is retrieved as expected, but once I do it in my code I get the error.

    Can anyone help in this matter?

    Thursday, November 12, 2015 3:01 AM

Answers

  • Figured out that there was a zero in the Working_Days_PWeek column.

    Changed to:

    IIf(not IsNull(P.WORKING_HOURS_PYEAR)
        and not IsNull(P.WORKING_DAYS_PWEEK)
        and P.WORKING_HOURS_PYEAR > 52
        and P.WORKING_DAYS_PWEEK > 0,
          CStr(Round(CDbl(P.WORKING_HOURS_PYEAR) / 52.0 / CDbl(P.WORKING_DAYS_PWEEK), 3)),
          P.WORKING_HOURS_PYEAR) as WORKING_HOURS_PDAY

    And everything started working correctly!

    • Marked as answer by Xm3KHs Thursday, November 12, 2015 4:06 AM
    Thursday, November 12, 2015 4:05 AM