Here is how I changed the SQL view of the query
SELECT qryTATTracking.FACID, IIf([ITCLS] Like "1*" Or [ITCLS] Like
"9*","GR",IIf([ITCLS] Like "2*","AC","OTHER")) AS TYPE,
dbo_WCDTALIBZ_WCRMIP00.[R4RMA#] AS [RHRMA#], dbo_WCDTALIBZ_WCRMIP00.R4CNAM AS
RHCNAM, dbo_WCDTALIBZ_WCRMIP00.R4ITNO, dbo_WCDTALIBZ_WCRMIP00.R4ITDS,
qryTATTracking.WHS, qryTATTracking.[PART NO], qryTATTracking.[SERIAL NO],
qryTATTracking.RECEIVED, Sum(qryTATTracking.[NO OF DAYS]) AS [STATUS DAYS],
WCKRConvertDate([R4UD16]) AS CLOSEDT
FROM (qryTATTracking LEFT JOIN dbo_WCDTALIBZ_WCRMIP00 ON qryTATTracking.RMA
= dbo_WCDTALIBZ_WCRMIP00.[R4RMA#]) LEFT JOIN qryKRROatBER ON
dbo_WCDTALIBZ_WCRMIP00.[R4RMA#] = qryKRROatBER.[RORMA#]
WHERE (((dbo_WCDTALIBZ_WCRMIP00.R4UD16)>10010101 And
(dbo_WCDTALIBZ_WCRMIP00.R4UD16) Between
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKRBegDt]) And
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKREndDt]))
AND ((dbo_WCDTALIBZ_WCRMIP00.R4STCD)="CLOSE" Or
(dbo_WCDTALIBZ_WCRMIP00.R4STCD)='C') AND ((qryKRROatBER.[RORMA#]) Is Null))
GROUP BY qryTATTracking.FACID, IIf([ITCLS] Like "1*" Or [ITCLS] Like
"9*","GR",IIf([ITCLS] Like "2*","AC","OTHER")),
dbo_WCDTALIBZ_WCRMIP00.[R4RMA#], dbo_WCDTALIBZ_WCRMIP00.R4CNAM,
dbo_WCDTALIBZ_WCRMIP00.R4ITNO, dbo_WCDTALIBZ_WCRMIP00.R4ITDS,
qryTATTracking.WHS, qryTATTracking.[PART NO], qryTATTracking.[SERIAL NO],
qryTATTracking.RECEIVED, WCKRConvertDate([R4UD16])
HAVING (((dbo_WCDTALIBZ_WCRMIP00.R4CNAM) Not Like "*Goodrich*") AND
((WCKRConvertDate([R4UD16])) AND Between [Forms]![frmMainMenu]![txtKRBegDt]
AND [Forms]![frmMainMenu]![txtKREndDt]))
ORDER BY qryTATTracking.FACID, dbo_WCDTALIBZ_WCRMIP00.R4CNAM;
Now it's telling me that I missing an operating and is highlighting the
Between in the following:
HAVING (((dbo_WCDTALIBZ_WCRMIP00.R4CNAM) Not Like "*Goodrich*") AND
((WCKRConvertDate([R4UD16])) AND Between [Forms]![frmMainMenu]![txtKRBegDt]
AND [Forms]![frmMainMenu]![txtKREndDt]))
ORDER BY qryTATTracking.FACID, dbo_WCDTALIBZ_WCRMIP00.R4CNAM;
--
B. J. Ayers
Goodrich Corp.
KARL DEWEY said:
Based on your conversion it appears the you are missing a digit --
WHERE (((dbo_WCDTALIBZ_WCRMIP00.R4UD16)>1001010 And
To be --
WHERE (((dbo_WCDTALIBZ_WCRMIP00.R4UD16)>10010101 And
:
This query was written by someone who is no longer working here.
The datatype for R4UD16 is Number
and the vb ConvertDateToWCKRDate module is:
Function ConvertWCDate(strDate As String) As String
ConvertWCDate = Mid(strDate, 5, 2) & "/" & Right(strDate, 2) & "/" &
Left(strDate, 4)
End Function
--
B. J. Ayers
Goodrich Corp.
:
If R4UD16 is a DateTime datatype then you need the following --
WHERE (((dbo_WCDTALIBZ_WCRMIP00.R4UD16)>#01/01/1001# And
(dbo_WCDTALIBZ_WCRMIP00.R4UD16) Between
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKRBegDt]) And
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKREndDt]))
Why do you have two parameters for R4UD16? If you always want the date to
be greater than 1 JAN 1001 then why use a BETWEEN statement?
Have you developed your own function ConvertDateToWCKRDate ?
:
Need help with a query written by someone else that is failing. Here is where
I think the query is failing. If you need all of the code for the query, let
me know.
From the query window:
Field = R4UD16
Table = dbo_WCDTALIBZ_WCRMIP00
Criteria = >1001010 And Between
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKRBegDt]) And
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKREndDt])
The code in the SQL view is:
WHERE (((dbo_WCDTALIBZ_WCRMIP00.R4UD16)>1001010 And
(dbo_WCDTALIBZ_WCRMIP00.R4UD16) Between
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKRBegDt]) And
ConvertDateToWCKRDate([Forms]![frmMainMenu]![txtKREndDt]))