Hello All, I have this code (see below) for keeping track of users logged in...It is in the "Form_Load" code and opposite code to delete in the "Form_Close" code.
I've just added a field to the table - [tblCurrentlyLoggedIn]; [empEnviron]. I added this field because I want to capture the PC name they are using.
How would I add the field and the 'Environ() AS empEnviron" into the existing code? Im stuck with the syntax and cant really find something that helps.
I would also like to add the field into the DELETE portion of the Form_Close code.
Any help would be greatly appreciated. Thank you in advance!
Form_load Code:
DoCmd.RunSQL "INSERT INTO tblCurrentlyLoggedIn ( empCurrentlyLoggedIn ) " & _
"SELECT CurrentUser() AS Users;"
Form_close Code:
DoCmd.RunSQL "DELETE * FROM tblCurrentlyLoggedIn WHERE empCurrentlyLoggedIn = CurrentUser()"
I've just added a field to the table - [tblCurrentlyLoggedIn]; [empEnviron]. I added this field because I want to capture the PC name they are using.
How would I add the field and the 'Environ() AS empEnviron" into the existing code? Im stuck with the syntax and cant really find something that helps.
I would also like to add the field into the DELETE portion of the Form_Close code.
Any help would be greatly appreciated. Thank you in advance!
Form_load Code:
DoCmd.RunSQL "INSERT INTO tblCurrentlyLoggedIn ( empCurrentlyLoggedIn ) " & _
"SELECT CurrentUser() AS Users;"
Form_close Code:
DoCmd.RunSQL "DELETE * FROM tblCurrentlyLoggedIn WHERE empCurrentlyLoggedIn = CurrentUser()"