Linking successful login to a form

ICTkirsten

Registered User.
Local time
Today, 15:40
Joined
Jan 3, 2015
Messages
137
Hello, i have created a login page and i have coded it but i do not know to set coding up so that it results in a linked form to open up..( main menu)

I Have added an attachment of the existing coding.

Please could someone help me :)


Thank you very much
 

Attachments

  • logincoding.jpg
    logincoding.jpg
    94.1 KB · Views: 227
Use DoCmd.OpenForm where you have the success message box.
 
Thank you for your swift response.

I am really unfamiliar with access and all my current work is done with the aid of youtube.

You said to use DoCmd.OpenForm
Where abouts in the code should i locate this?

Thanks so much:)
 
Private Sub btnOK_Click()

If IsNull(Me.txtUsername) Then
MsgBox "Please enter your username.", vbInformation, "Username Is Required"
Me.txtUsername.SetFocus
Else
If IsNull(Me.TxtPassword) Then
MsgBox "Please enter your password.", vbInformation, "Password Is Required"
Me.TxtPassword.SetFocus
Else
If (IsNull(DLookup("[Username]", "Employee_Login_Details", "[Username] ='" & Me.txtUsername.Value & "' And password = '" & Me.TxtPassword.Value & "'"))) Then
MsgBox "Incorrect username or password. Please try again.", vbInformation, "Incorrect Login Details"
Else
MsgBox "Correct username and password.", vbInformation, "Correct Login Details"
End If
End If
End If
End Sub



this is the current code
 
Replace this line:

MsgBox "Correct username and password.", vbInformation, "Correct Login Details"
 
i have now inputted this but it still doesnt work..


Private Sub btnOK_Click()

If IsNull(Me.txtUsername) Then
MsgBox "Please enter your username.", vbInformation, "Username Is Required"
Me.txtUsername.SetFocus
Else
If IsNull(Me.TxtPassword) Then
MsgBox "Please enter your password.", vbInformation, "Password Is Required"
Me.TxtPassword.SetFocus
Else
If (IsNull(DLookup("[Username]", "Employee_Login_Details", "[Username] ='" & Me.txtUsername.Value & "' And password = '" & Me.TxtPassword.Value & "'"))) Then
MsgBox "Incorrect username or password. Please try again.", vbInformation, "Incorrect Login Details"
Else

DoCmd.OpenForm (MainMenu)
End If
End If
End If
End Sub
 
sorry didnt mean for such an abrupt presentation of text
 
my original coding was wrong but i have worked it out and thank you to your added comments everything is working fine now :)
 
No problem, glad you got it sorted.
 

Users who are viewing this thread

Back
Top Bottom