Hi,
I have this login form in Access 2003 which works perfect. I want to add one more thing but I do not know how.
I want a message to pop up when the password is typed wrong. Right now if the password is typed wrong it goes to microsoft login screen.
Here is the code I have behind the button:
On Error GoTo ErrorPoint
Dim strPath As String
Dim strAccDir As String
Dim strAccPath As String
If Len(Nz(Me!txtUserName, "")) = 0 Then
' User Name box is empty
MsgBox "Please enter your User Name before continuing.", _
vbInformation, "Enter User Name"
Me.txtUserName.SetFocus
GoTo ExitPoint
End If
If Len(Nz(Me!txtPassword, "")) = 0 Then
' Password box is empty
MsgBox "Please enter your Password before continuing.", _
vbInformation, "Missing Password"
Me.txtPassword.SetFocus
GoTo ExitPoint
End If
strAccDir = SysCmd(acSysCmdAccessDir)
strAccPath = strAccDir & "MSACCESS.EXE"
' When you have entered the correct path to your database file
' and the workgroup file, then uncomment the rest of this procedure
' and remove the message box code
strPath = Chr(34) & strAccPath & Chr(34) & " " _
& Chr(34) & "J:\Database\Client Database\Client Database.mdb" & Chr(34) & " " _
& "/wrkgrp " & Chr(34) & "J:\Database\Client Database\Security.mdw" & Chr(34) & " " _
& "/User " & Chr(34) & Me.txtUserName & Chr(34) & " " _
& "/Pwd " & Chr(34) & Me.txtPassword & Chr(34)
Shell strPath, vbMaximizedFocus
Application.Quit
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
Thanks in advance
I have this login form in Access 2003 which works perfect. I want to add one more thing but I do not know how.
I want a message to pop up when the password is typed wrong. Right now if the password is typed wrong it goes to microsoft login screen.
Here is the code I have behind the button:
On Error GoTo ErrorPoint
Dim strPath As String
Dim strAccDir As String
Dim strAccPath As String
If Len(Nz(Me!txtUserName, "")) = 0 Then
' User Name box is empty
MsgBox "Please enter your User Name before continuing.", _
vbInformation, "Enter User Name"
Me.txtUserName.SetFocus
GoTo ExitPoint
End If
If Len(Nz(Me!txtPassword, "")) = 0 Then
' Password box is empty
MsgBox "Please enter your Password before continuing.", _
vbInformation, "Missing Password"
Me.txtPassword.SetFocus
GoTo ExitPoint
End If
strAccDir = SysCmd(acSysCmdAccessDir)
strAccPath = strAccDir & "MSACCESS.EXE"
' When you have entered the correct path to your database file
' and the workgroup file, then uncomment the rest of this procedure
' and remove the message box code
strPath = Chr(34) & strAccPath & Chr(34) & " " _
& Chr(34) & "J:\Database\Client Database\Client Database.mdb" & Chr(34) & " " _
& "/wrkgrp " & Chr(34) & "J:\Database\Client Database\Security.mdw" & Chr(34) & " " _
& "/User " & Chr(34) & Me.txtUserName & Chr(34) & " " _
& "/Pwd " & Chr(34) & Me.txtPassword & Chr(34)
Shell strPath, vbMaximizedFocus
Application.Quit
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
Thanks in advance