If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Data Not Saving When Closing the DB
I have a few Procedures for storing LogIn/LogOff Information in my database.
When a user logs in, the event is written to an EVENT table. Also, upon logging in I write that users employee number to a CURRENTLY_LOGGED_IN table so that I can query active users at any time (going to be used for in-program instant messaging). My problem is when it comes to users closing the database. I have a hidden form running in my database which holds timer events an such, so I have code that when that form closes it should clear out the current user from the CURRENTLY_LOGGED_IN table also write a LogOff time stamp to the EVENT table. What happens is that I get a time stamp in the EVENT table but the Employee_ID field is always 0. I am using a global variable to hold the current user but the ID never gets written to the table. Also, the record matching the Employee in the CURRENTLY_LOGGED_IN is not deleting. I cann't set a stop on the form close to debug anything, it all seems to fire quick and dump all the information in the variables. Can anyone give me any suggestions on what's happening? Thanks!!! -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Data Not Saving When Closing the DB
Often an error will clear a Global variable. Create a function which will
fill the variable before you call it upon the database closing. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Dustin via AccessMonster.com" u48758@uwe wrote in message news:9d7eda5477178@uwe... I have a few Procedures for storing LogIn/LogOff Information in my database. When a user logs in, the event is written to an EVENT table. Also, upon logging in I write that users employee number to a CURRENTLY_LOGGED_IN table so that I can query active users at any time (going to be used for in-program instant messaging). My problem is when it comes to users closing the database. I have a hidden form running in my database which holds timer events an such, so I have code that when that form closes it should clear out the current user from the CURRENTLY_LOGGED_IN table also write a LogOff time stamp to the EVENT table. What happens is that I get a time stamp in the EVENT table but the Employee_ID field is always 0. I am using a global variable to hold the current user but the ID never gets written to the table. Also, the record matching the Employee in the CURRENTLY_LOGGED_IN is not deleting. I cann't set a stop on the form close to debug anything, it all seems to fire quick and dump all the information in the variables. Can anyone give me any suggestions on what's happening? Thanks!!! -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Data Not Saving When Closing the DB
I tried calling it from a global function, no go. I also placed the code in
the unload event and not the close event, still nothing, I did a debug.print global variable name and it's returning a 0 still. I've done this before any of the code fires in case there was some type of error, but I do have error trapping on the procedure. Arvin Meyer [MVP] wrote: Often an error will clear a Global variable. Create a function which will fill the variable before you call it upon the database closing. I have a few Procedures for storing LogIn/LogOff Information in my database. [quoted text clipped - 23 lines] Thanks!!! -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Data Not Saving When Closing the DB
Try using this function to get the username:
http://www.mvps.org/access/api/api0008.htm And call that function to supply the username in the event. Obviously the event is firing, because you are getting the timestamp. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "dustinw101 via AccessMonster.com" u48758@uwe wrote in message news:9d821f6519570@uwe... I tried calling it from a global function, no go. I also placed the code in the unload event and not the close event, still nothing, I did a debug.print global variable name and it's returning a 0 still. I've done this before any of the code fires in case there was some type of error, but I do have error trapping on the procedure. Arvin Meyer [MVP] wrote: Often an error will clear a Global variable. Create a function which will fill the variable before you call it upon the database closing. I have a few Procedures for storing LogIn/LogOff Information in my database. [quoted text clipped - 23 lines] Thanks!!! -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|