i have this query in vb6 program:
sSQL = "SELECT Count([WDATE]) From WHOURS Where [EMPID]=" & EMPID & " AND (([WDATE] Between (" & STD & "-31) And (" & STD & "-1)));"
debug.print sSQL looks like:
SELECT Count([WDATE]) From WHOURS Where [EMPID]=154 AND (([WDATE] Between (7/01/12-31) And (7/01/12-1)));
it doesn't give me the right number, it gives me zero every time. i suspect this criteria format '(7/01/12-31)' is causing the problem.
for example, this query in ms access gives me the right count
SELECT Count([WDATE]) AS Expr1
FROM WHOURS
WHERE (((WHOURS.EMPID)=154) AND ((WHOURS.WDATE) Between (NOW()-31) And (NOW()-1)));
can you please help me to get proper format for vb6?
sSQL = "SELECT Count([WDATE]) From WHOURS Where [EMPID]=" & EMPID & " AND (([WDATE] Between (" & STD & "-31) And (" & STD & "-1)));"
debug.print sSQL looks like:
SELECT Count([WDATE]) From WHOURS Where [EMPID]=154 AND (([WDATE] Between (7/01/12-31) And (7/01/12-1)));
it doesn't give me the right number, it gives me zero every time. i suspect this criteria format '(7/01/12-31)' is causing the problem.
for example, this query in ms access gives me the right count
SELECT Count([WDATE]) AS Expr1
FROM WHOURS
WHERE (((WHOURS.EMPID)=154) AND ((WHOURS.WDATE) Between (NOW()-31) And (NOW()-1)));
can you please help me to get proper format for vb6?