Global Variable in form

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi,

I hope you can help me.

I have a global variable that I use in a login form. I would like to update
each table (depending what form the user is in) with that variable in a
username field on insert and update. how can I do that??

1.) User is in a form, ready to update a record.
2.) Variable needs to populate the UserName field in table, maybe also
lastaccessed date field.

Any suggestion are appreciated.

Steve
 
Steve,

In the AfterUpdate of the Form just put in some code to poke
the Global Variable in. Air code following with no error
handling.

Sub YourForm_AfterUpdate

Me!UserName = gblUser ' or whatever you named it.
Me!LastAccessed = Now()

End Sub

Gary Miller
Sisters, OR
 
Thank you for your help. That works, but now I can't go to the next
record,and when I try to close the form, I get an error msg, that my data
will be lost.

What am I missing?? Please let me know.

Steve

Here is the code in my form........

Private Sub Form_AfterUpdate()

Me!Text23 = UsernameVar ' or whatever you named it.

'Me!LastAccessed = Now()

End Sub
 
Back
Top