Connecting Tech Pros Worldwide Help | Site Map

Add record OnClose

Funone
Guest
 
Posts: n/a
#1: Nov 13 '05
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.

Salad
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Add record OnClose


Funone wrote:
[color=blue]
> 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.
>[/color]

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() & "#)"

Funone
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Add record OnClose


Thank you Salad for your answer! Got it working.

Closed Thread