Global Variable in form

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
 
G

Gary Miller

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
 
S

Steve

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
 

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