Hi everyone!
In my database I have implemented a number of login features to protect the database. Every 60 days users are forced to update their password, and if they have not logged in for 90 days they are prevented from logging in until an administrator restores their privileges. In order to help managers track which users have been inactivated, I created a report that is emailed to them after a inactivated user attempts to log on.
However, a message box pops up asking for the "UserID" parameter, after the user has attempted to log in and the report is being generated and emailed to the managers. I have rewritten the query, and it still produces this message. The query is based off of two tables ... tblUsers, where the PK is "ID", and tblPWChange, where "ID" is a FK but stored as "UserID".
Here is the OG query:
Here is the new Query:
I thought the issue was related to the fact that there are multiple rows in tblPWChange where the ID/UserID is referenced ... hence, my solution was to add the Select Subqueries. But this has not worked. Can anyone help me to troubleshoot this issue?
Many thanks!!!
In my database I have implemented a number of login features to protect the database. Every 60 days users are forced to update their password, and if they have not logged in for 90 days they are prevented from logging in until an administrator restores their privileges. In order to help managers track which users have been inactivated, I created a report that is emailed to them after a inactivated user attempts to log on.
However, a message box pops up asking for the "UserID" parameter, after the user has attempted to log in and the report is being generated and emailed to the managers. I have rewritten the query, and it still produces this message. The query is based off of two tables ... tblUsers, where the PK is "ID", and tblPWChange, where "ID" is a FK but stored as "UserID".
Here is the OG query:
Code:
SELECT a.ID, a.UserName, b.dtPwExpiry, b.dtUserInactivate
FROM tblUsers AS a INNER JOIN tblPWChange AS b ON a.ID = b.UserID
WHERE a.daysToInactivate <= 0;
Here is the new Query:
Code:
SELECT a.ID, a.UserName, (SELECT MAX(dtPwExpiry) FROM tblPWChange WHERE UserID = a.ID) AS dtPwExpiry, (SELECT MAX(dtUserInactivate) FROM tblPWChange WHERE UserID = a.ID) AS dtUserInactivate
FROM tblUsers AS a
WHERE a.daysToInactivate <= 0;
I thought the issue was related to the fact that there are multiple rows in tblPWChange where the ID/UserID is referenced ... hence, my solution was to add the Select Subqueries. But this has not worked. Can anyone help me to troubleshoot this issue?
Many thanks!!!
Last edited: