belly0fdesire
Registered User.
- Local time
- Today, 11:47
- Joined
- Dec 1, 2005
- Messages
- 11
I am using the following function created in a module:
I am then using this as the default value of a field in a form. It is going to lookup what the user puts in as a date and return the value for that user on that date. But if there is nothing entered for that date, it returns an invalid use of Null error. Is there a way around this.
Sorry... I'm still very new at this. Thanks in advance for your help.
PS I would like to have it just return a zero when there is nothing entered for that date...
Code:
Public Function StraightTimeLookup(ByVal UName As String, _
ByVal dat1 As Date) As Integer
StraightTimeLookup = DLookup("[StraightTime]", "StraightTime", _
"[User] = '" & UName & _
"' AND [Date] = #" & dat1 & "#")
End Function
I am then using this as the default value of a field in a form. It is going to lookup what the user puts in as a date and return the value for that user on that date. But if there is nothing entered for that date, it returns an invalid use of Null error. Is there a way around this.
Sorry... I'm still very new at this. Thanks in advance for your help.
PS I would like to have it just return a zero when there is nothing entered for that date...
Last edited: