Data Not Saving When Closing the DB

  • Thread starter Dustin via AccessMonster.com
  • Start date
D

Dustin via AccessMonster.com

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!!!
 
A

Arvin Meyer [MVP]

Often an error will clear a Global variable. Create a function which will
fill the variable before you call it upon the database closing.
 
D

dustinw101 via AccessMonster.com

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.

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!!!
 
A

Arvin Meyer [MVP]

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 said:
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.

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!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top