I'm sharing this simple Login Form which I created using MS Access. I hope this will help Access newbies to become more comfortable with the program. I'm sure there are a number of ways to do this (perhaps much better than this) but I did what I could to make this simple and straight-forward.
I. Access Objects in this application:
1. tblUsers - table for application users
1. frmLogin - start-up form
**User Name - Erick, Password - erick
**User Name - Billy , Password - billy
2. frmMenu - opens when user supplies correct user and password at Login form
1. GVar - here is where I declared my Global variables 'strUser' and 'strRole'
Prompts if the User combobox and/or Password text box has no entry
Prompts if the user types another name which isn't included in the list
Program closes when the user enters 3 consecutive wrong password
Login Form closes when correct password is supplied, greets the user, and opens the frmMenu.
Sets the value of strUser and strRole global variables which shall be used throughout user session.
User name and role is displayed
Command button is enabled or disabled based on the value of strRole (enabled for 'Admin' and disabled for 'Encoder'
III. Tips for newbies
Learn and be more comfortable using the If... Then... Else Statement
Learn how to declare variables and variable scoping (Private, Public, Global)
Dlookup function parameters and syntax
IV. Gotcha Moment
Docmd.Close in frmLogin prompts and runtime error 2585 so be sure to include the On Error Handler line
Hope this helps...
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.