dbTalk Databases Forums  

Add record OnClose

comp.databases.ms-access comp.databases.ms-access


Discuss Add record OnClose in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Funone
 
Posts: n/a

Default Add record OnClose - 01-07-2005 , 04:36 PM






I need to get hold on when, and more important which user last closed
this Access application (closed the mainform). This way I could have
the user that last time used the application to be the default value in
the combo box where the user is choosen upon next login.

Tried making a table containing the user data (Firma_ID) which can be
red from the mainforms textbox called txt_firma. Also, as a nice
feature I tried to get the date & time when every user last used the
aplikation as a information on the login-page (by having a date/time
field in the table with it's default value as now().

How would I get this new record to the table every time mainform is
closed? Tried append query without success, should probably been made
by code.


Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Add record OnClose - 01-07-2005 , 06:07 PM






Funone wrote:

Quote:
I need to get hold on when, and more important which user last closed
this Access application (closed the mainform). This way I could have
the user that last time used the application to be the default value in
the combo box where the user is choosen upon next login.

Tried making a table containing the user data (Firma_ID) which can be
red from the mainforms textbox called txt_firma. Also, as a nice
feature I tried to get the date & time when every user last used the
aplikation as a information on the login-page (by having a date/time
field in the table with it's default value as now().

How would I get this new record to the table every time mainform is
closed? Tried append query without success, should probably been made
by code.

In the OnCLose event of the MainForm, copy the statement below. Change
the Table1 to your table name, and change UserName, TimeClosed to the
field names in your table.

Currentdb.Execute "Insert Into Table1 ([UserName], [TimeClosed]) Values
('" & CurrentUser & "', #" & Now() & "#)"



Reply With Quote
  #3  
Old   
Funone
 
Posts: n/a

Default Re: Add record OnClose - 01-08-2005 , 07:10 AM



Thank you Salad for your answer! Got it working.


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.