Is there a way to pull the data in the "FROM" clause from the subform (instead of a table)? Here's what I have tried to do with the code you provided, but when I click on the button to run the function, getting a "run-time error" 3131 that the FROM statement is incorrect:
.........
Dim strSQL As String
Dim slogoff As Date
Set db = CurrentDb
Set rs1 = db.OpenRecordse t("SELECT * FROM Forms!sessionfo rm.subformdate. Form! ORDER BY LogonhostDate")
Set rs2 = db.OpenRecordse t("SELECT * FROM Forms!sessionfo rm.subformdate. Form! ORDER BY LogoffhostDate" )
rs1.MoveFirst
Do Until rs1.EOF
If Not IsNul
.........
Dim strSQL As String
Dim slogoff As Date
Set db = CurrentDb
Set rs1 = db.OpenRecordse t("SELECT * FROM Forms!sessionfo rm.subformdate. Form! ORDER BY LogonhostDate")
Set rs2 = db.OpenRecordse t("SELECT * FROM Forms!sessionfo rm.subformdate. Form! ORDER BY LogoffhostDate" )
rs1.MoveFirst
Do Until rs1.EOF
If Not IsNul
Comment