Code:
Set rsEnter = db.OpenRecordset("SELECT XacnTime, XacnEntEx, XacnEmpName, XacnGroup, XacnCourse, XacnType, XacnAuth, XacnStatIn FROM tblXacn WHERE (XacnDate BETWEEN (#" & Forms!frmParameters!txtStart & "#) AND (#" & Forms!frmParameters!txtEnd & "#)) AND [XacnStatus] = 'Red';")
Do While Not rsEnter.EOF
Debug.Print rsEnter![XacnTime], rsEnter![XacnEntEx], rsEnter![XacnGroup], rsEnter![XacnCourse], rsEnter![XacnAuth], rsEnter![XacnStatIn] & vbCr
Set rsExit = db.OpenRecordset("SELECT XacnTime, XacnEntEx, XacnEmpName, XacnGroup, XacnCourse, XacnType, XacnAuth, XacnStatOut " & _
"FROM tblXacn " & _
"WHERE (XacnDate BETWEEN (#" & Forms!frmParameters!txtStart & "#) AND (#" & Forms!frmParameters!txtEnd & "#)) AND [XacnStatOut] = " & rsEnter!XacnStatIn & ";")
Do While Not rsExit.EOF
Debug.Print rsExit![XacnTime], rsExit![XacnEntEx], rsExit![XacnGroup], rsExit![XacnCourse], rsExit![XacnAuth], rsExit![XacnStatOut] & vbCr
rsExit.MoveNext
Loop
rsExit.Close
rsEnter.MoveNext
Loop
A temp table doesn't actually have to be temporary, the records are temporary. Create and save the table with the desired field structure. Save records to the table with sql INSERT action in place of the Debug lines:
CurrentDb.Execute "INSERT INTO tablename(fieldname1, fieldname2, fieldname3) VALUES(#" & rsExit!XacnTime & "#, '" & rsExit!XacnEntEx & "', " & rsExit!xacnGroup
At beginning of the procedure make sure the temp table is empty:
CurrentDb.Execute "DELETE FROM tablename"