SELECT
USERINFO.Name, USERINFO.SSN, USERINFO.Badgenumber,
FORMAT((Min(CHECKINOUT.CHECKTIME)),"dd-mmm-yyyy hh:mm am/pm") AS TIMEINAM,
FORMAT((Max(CHECKINOUT.CHECKTIME)),"dd-mmm-yyyy hh:mm am/pm") AS TIMEOUTAM
FROM
CHECKINOUT
INNER JOIN
USERINFO ON CHECKINOUT.USERID = USERINFO.USERID
WHERE
(CHECKINOUT.CHECKTIME >= DATEVALUE(PERIOD_START) AND
CHECKINOUT.CHECKTIME < DATEADD("d", 1, PERIOD_END) AND
FORMAT(CHECKINOUT.CHECKTIME, "AMPM") = "AM") AND
USERINFO.Name = Insert_Name
GROUP BY
CHECKINOUT.USERID, USERINFO.Name, USERINFO.SSN,
DateValue(CHECKINOUT.CHECKTIME), USERINFO.Badgenumber
HAVING
(((USERINFO.Badgenumber) < "8000"))
ORDER BY
USERINFO.Name, Min(CHECKINOUT.CHECKTIME);
查询此显示timein和timeout -AM
的输出SELECT
USERINFO.Name,
FORMAT((Min(CHECKINOUT.CHECKTIME)),"dd-mmm-yyyy hh:mm am/pm") AS TIMEINPM,
FORMAT((Max(CHECKINOUT.CHECKTIME)),"dd-mmm-yyyy hh:mm am/pm") AS TIMEOUTPM
FROM
CHECKINOUT
INNER JOIN
USERINFO ON CHECKINOUT.USERID = USERINFO.USERID
WHERE
(CHECKINOUT.CHECKTIME >= DATEVALUE(PERIOD_START) AND
CHECKINOUT.CHECKTIME < DATEADD("d",1,PERIOD_END) AND
FORMAT(CHECKINOUT.CHECKTIME, "AMPM") = "PM") AND
USERINFO.Name = Insert_Name
GROUP BY
CHECKINOUT.USERID, USERINFO.Name, USERINFO.SSN,
DateValue(CHECKINOUT.CHECKTIME), USERINFO.Badgenumber
HAVING
(((USERINFO.Badgenumber) < "8000"))
ORDER BY
USERINFO.Name, Min(CHECKINOUT.CHECKTIME);
查询2 - PM的时间和超时。
我需要一起显示这两个查询的输出。拥有USERINFO.Name和DATE
答案 0 :(得分:0)
您似乎只需要按时分组:
Dim fname as Variant
fname = Dir("D:\FORMULAS\BABERs FORMULAS*")
If fname <> "" then
Workbooks.open (fname)
End If