Solved How to fill in user's name into forms automatically? (1 Viewer)

yunhsuan

Member
Local time
Today, 09:06
Joined
Sep 10, 2021
Messages
54
Hello,
I built a login screen in my access by referring to a website.
There is a table to store login details, containing ID, username, password and User.
User need to key in username and password to login.
After user successful login, the form, Test, would be opened.
I hope User can be filled in the cell in this "Test" form, according to the username and password.
Does any one tell me how to achieve it? Thank in advance.

Below is my test file.
username: aaa
password: 123
 

Attachments

  • Database5.accdb
    1.2 MB · Views: 367

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:06
Joined
Oct 29, 2018
Messages
21,467
Hi. One approach is to not close your login form. Simply hide it using Me.Visible=False, instead of DoCmd.Close. You can then refer to its controls to grab the login information for your other needs.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 20:06
Joined
Feb 28, 2001
Messages
27,167
Another approach is to look into something called TempVars which you can use to store up to a couple of hundred text or numeric values. If the login form CREATES the TempVar object and stores, say, "Username" and other items you can easily look up during a login, then that TempVar will persist for the life of the session. Any other form can reference it.


This might get you started.

Please note: There are other methods available. This one is one of the simpler ones for persistent values in a session.
 

Users who are viewing this thread

Top Bottom