LogIn form question (1 Viewer)


Registered User.
Local time
Yesterday, 21:52
May 6, 2008
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"
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"
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

Exit Sub
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

Thanks in advance

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 02:52
Jul 9, 2003
It appears to me that the user name and password you are collecting and then passing along in your code are the windows workgroup username and password.

If that’s the case then I think you would need to find a forum specializing in windows and in particular windows workgroups.

Once you have found such a forum, then you would need to satisfy yourself that you could solve the following problems, or alternatively come up with a different method.
First of all you need to find out if an error message is generated when the incorrect username and/or password is passed to the work group opening procedure, then you would need to work out how to monitor this error message from your VBA code.

I suspect it’s something that could be done, however it’s not the sort of thing I would volunteer to do myself, I think it could well be a headache!


1) Have the user’s login to the workgroup first then you haven’t got to worry about it, it’s someone else’s problem! I haven’t got a clue if this is possible, but it seems a more logical step to me.

2) Use your own custom password system in your access database then have one generic login name that you use for opening the workgroup. Could be something like
username: “access user”
Password: “access user password”

Then just pass these through in your code instead of having unique individual logins.

Users who are viewing this thread

Top Bottom