Username Variable

molloyjh

Registered User.
Local time
Today, 12:53
Joined
Jun 23, 2009
Messages
13
Hi,

I'm fairly new to VBA and have a db that tracks incoming queries. I have a log on form that checks the username selected from a drop down and the password entered. This all works ok. However when the user logs on and goes into the form to enter the query details I want their username to populate a field on that screen.

The code for the log on form is as follows:

If Me.Password.Value = DLookup("Password", "Users", _
"[User Id]=" & Me.Username.Value) Then

MyUserID = Me.Username.Value

DoCmd.Close acForm, "LogOn Form", acSaveNo
DoCmd.OpenForm "Main Menu"

The value that is stored to MyUserID is the ID on the Users table. How to I then use that to populate a text box on another form?

Thanks,
John.
 
you can use mytext1=myuserid on some event of form
 
D'uh....can't believe I didn't even try that! :o

Thanks khawar.
 

Users who are viewing this thread

Back
Top Bottom