A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Data Not Saving When Closing the DB



 
 
Thread Tools Display Modes
  #1  
Old October 12th, 2009, 08:37 PM posted to microsoft.public.access.forms
Dustin via AccessMonster.com
external usenet poster
 
Posts: 1
Default 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  
Old October 12th, 2009, 08:44 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default 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  
Old October 13th, 2009, 02:52 AM posted to microsoft.public.access.forms
dustinw101 via AccessMonster.com
external usenet poster
 
Posts: 5
Default 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  
Old October 13th, 2009, 03:34 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.