Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA login code for access

Status
Not open for further replies.

adrenalynn06

Technical User
Mar 7, 2006
1
GB
dose anyone know how i can create login form were the user can enter login name and password??

any idea on vba code??

 
In what application? Excel? Access?

Ed Metcalfe.

Please do not feed the trolls.....
 
Doh! Sorry, should have read your post more carefully.

Assuming you want each user to have their own user name and password:

Create a two field table containing UserName and Password fields.

Create a form with a combobox for the user name and a textbox for the password.

Create a button with the following code behind it:

Private Sub cmdCheckPassword_Click()
If Me.txtPassword.Value = DLookup("Password", "tblUsers", "UserName=" & """" & Me.cboUserName.Value & """") Then
'Password correct, open system's main form
Else
'Password incorrect, deny access.
End If
End Sub

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top