Les Isaacs
Registered User.
- Local time
- Today, 21:42
- Joined
- May 6, 2008
- Messages
- 186
Hi All
I have a query which runs fine until I set a criteria (of True) in the field
So without the criteria, I have
and in the query results I see 0 and -1 as expected for the 'chase_it' expression
BUT
When I add True (or -1, or 0) as a criteria for 'chase_it', I get the "Data type mismatch in criteria expression" error
So the sql that fails is
In case it's relevant, my function prevwd is:
and this function is used extensively and always works perfectly. Before anyone asks, I have tried using DateAdd instead of dt = dt - 1, but that made no difference.
I've tried all sorts, but am now at a loss :banghead:
Hope someone can help.
Many thanks
Les
I have a query which runs fine until I set a criteria (of True) in the field
Code:
chase_it: prevwd([practice_bacs_submission_date])<Date()
Code:
SELECT prevwd([practice_bacs_submission_date])<Date() AS chase_it, practice_bacs.practice_bacs_submission_date
FROM practice_bacs
WHERE (((practice_bacs.practice_bacs_submission_date)>#1/31/2013#));
BUT
When I add True (or -1, or 0) as a criteria for 'chase_it', I get the "Data type mismatch in criteria expression" error
So the sql that fails is
Code:
SELECT prevwd([practice_bacs_submission_date])<Date() AS chase_it, practice_bacs.practice_bacs_submission_date
FROM practice_bacs
WHERE (((prevwd([practice_bacs_submission_date])<Date())=True) AND ((practice_bacs.practice_bacs_submission_date)>#1/31/2013#));
Code:
Function prevwd(dt As Date) As Date
10 On Error GoTo prevwd_Error
20 dt = dt - 1
30 While Weekday([dt]) = 1 Or Weekday([dt]) = 7 Or IsBankHoliday(dt)
40 dt = dt - 1
50 Wend
60 prevwd = dt
70 On Error GoTo 0
80 Exit Function
prevwd_Error:
90 Call WriteErrors(Erl, Err.number, Err.Description, "prevwd", "Module", "PayrollCalc safe 2000 2001")
End Function
I've tried all sorts, but am now at a loss :banghead:
Hope someone can help.
Many thanks
Les