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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Goto Control

Status
Not open for further replies.

gloudo

Programmer
Feb 3, 2002
34
NL
Hello,

I have A login script for an Accessdb.
When a password is wrongly submitted it has to return to the pasword textbox. It Won't go back to the box.
What's wrong?

Private Sub Password_AfterUpdate()
Dim BtnValue As Integer


If IsNull(DLookup("Password", "Gebruikers", "UserName='" & Me.UserName & "'")) Then
BtnValue = MsgBox("Verkeerde gebruikersnaam ingevoerd!", vbExclamation + vbOKOnly, "Gebruikersnaam")
If BtnValue = vbOK Then DoCmd.GoToControl "UserName"

Else
If DLookup(&quot;Password&quot;, &quot;Gebruikers&quot;, &quot;UserName='&quot; & Me.UserName & &quot;'&quot;) <> Me.Password Then
MsgBox &quot;Invallid Password&quot;
Me.Password = Null
DoCmd.GoToControl &quot;Password&quot;

Else
DoCmd.OpenForm &quot;Switchboard&quot;, acNormal, , , , acWindowNormal
DoCmd.Close acForm, &quot;Login&quot;, acSaveNo
End If
End If
End Sub
 
Hi,
Replace your primary IF condition with a Do While condition...Loop.

:) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top