WorkingDays funtion in query problem (1 Viewer)

Franky G

Registered User.
Local time
Today, 08:39
Joined
Feb 6, 2001
Messages
62
Hi,

I'm trying to identify applications which have been in the system from more than x days but not responded to, x being variable and entered onto a user form.

I'm trying to calculate working days between 2 dates, using this function;

Public Function WorkingDays(FromDate As Date, UntilDate As Date) As Integer
If IsNull(FromDate) Or IsNull(UntilDate) Then
WorkingDays = 0
Exit Function
End If
If UntilDate <= FromDate Then
WorkingDays = 1
Else
WorkingDays = WeekDays(FromDate, UntilDate) - Holidays(FromDate, UntilDate)
End If
End Function

Weekdays and Holidays functions have been defined.

My Query field is TimeTaken: WorkingDays([RECPTD],[DATE()])
in the criteria box I have >([Forms]![frmMainMenu]![NoOfDays])

When I run the query I get prompted to enter parameter value DATE(). I just can't figure this one out, any help would be appreciated,

Thanks

FrankyG
 

Cosmos75

Registered User.
Local time
Today, 02:39
Joined
Apr 22, 2002
Messages
1,281
You've put [] around DATE() so I think Access thinks it is a field instead of a function. Try leaving out [ & ], just put Date().
 

Franky G

Registered User.
Local time
Today, 08:39
Joined
Feb 6, 2001
Messages
62
I don't believe I didn't try that...is it not the most obvious thing in the world :rolleyes: It works...It's Miller Time...:D

Thanks!

FrankyG
 

Cosmos75

Registered User.
Local time
Today, 02:39
Joined
Apr 22, 2002
Messages
1,281
FrankyG,

You're very welcome.
It is a rare ocassion when I am actually of help to someone!
:D
 

Users who are viewing this thread

Top Bottom