Question : How to display users who have not submitted their reports.

The code below displays the list of users who submitted their reports last month. I wonder if it's possible the get the list of users who have not submitted their reports. Their names are in the MyUsers column
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("database\MonthlyReports.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT MyUsers FROM ReportTable WHERE MonthOfReport LIKE 'June' AND YearOfReport like '2010' order by MyUsers", conn

Dim Msg

do until rs.EOF
    Msg = Msg & rs("MyUsers") & ", "
    rs.MoveNext
loop
'remove the last comma
Msg = left(Msg, len(Msg) - 2)
response.write "The following users haven't submitted their reports last month: " & Msg
%>

Answer : How to display users who have not submitted their reports.

If you have a good index on ReportTable.MyUser, then this query should work.
1:
rs.Open "Select Distinct MyUsers from ReportTable where MyUsers not in (SELECT Distinct MyUsers FROM ReportTable WHERE MonthOfReport LIKE 'June' AND YearOfReport like '2010') order by MyUsers", conn
Random Solutions  
 
programming4us programming4us