I am trying to use a function in a query to calculate a field's value. When I open the form, which is based on the query, I get the error "You entered an expression that has no value"
I think my syntax in the query grid may be incorrect:
DayCountResult: CountDaysToFinish()
Here is the function:
Public Function CountDaysToFinish()
If (IsNull(Forms!Main!dtFinished) Or Forms!Main!dtFinished = "") Then
Forms!Main!DaysToFinish = DateDiff("d", Forms!Main!dtInitialized, Now)
ElseIf (Not IsNull(Forms!Main!dtFinished) Or Forms!Main!dtFinished <> "") Then
Forms!Main!DaysToFinish = DateDiff("d", Forms!Main!dtInitialized, Forms!Main!dtFinished)
End If
End Function
The db is attached, in case you want to see what I have.
Any help?
I think my syntax in the query grid may be incorrect:
DayCountResult: CountDaysToFinish()
Here is the function:
Public Function CountDaysToFinish()
If (IsNull(Forms!Main!dtFinished) Or Forms!Main!dtFinished = "") Then
Forms!Main!DaysToFinish = DateDiff("d", Forms!Main!dtInitialized, Now)
ElseIf (Not IsNull(Forms!Main!dtFinished) Or Forms!Main!dtFinished <> "") Then
Forms!Main!DaysToFinish = DateDiff("d", Forms!Main!dtInitialized, Forms!Main!dtFinished)
End If
End Function
The db is attached, in case you want to see what I have.
Any help?