If IsNull (Me) the UserName) Then Rem Me. UserName: current reference form controls the Me the attribute of the
MsgBox (" please enter your user name ")
'is used to display a message box result and returns the user response
Me. The UserName. SetFocus
'the mouse to point to in the UserName
ElseIf IsNull (Me) keyword) Then
MsgBox (" please enter your password "), vbCritical
'icon style display (vb) Red Cross (X) round icon
Me. Keyword. SetFocus
'the mouse to point to in keyword
The Else
StrSQL="select * from table 1 where the UserName='" & amp; Me. The UserName & amp; "'
"Rs. Open the STR
CurrentProject. Connection ',
AdOpenoptimistic, adLockReadOnly
If (rs (" keyword ")=keyword) Then
Me. The Visible=False
DoComd. Close 'Close the current active window
DoComd. OpenForm "table" students' open the student table form
The Else
MsgBox "the password you entered is incorrect, please enter again! Such as password forgotten, please contact the administrator "vbCritical
'icon style display (vb) Red Cross (X) round icon
Rs. Close
Set. The rs=Nothing
The Exit Sub
End the If
End the If
End the If
Me. The UserName=""
Me. Myword=""
End Sub
CodePudding user response:
Is there less an ifElse if
StrSQL="select * from
CodePudding user response:
1: event procedure code, line 1, Then behind from Rem started to change to the next line,Or put the Rem into English single quotes,
2: behind wrote an End If more,
CodePudding user response:
Architecture itself is not reasonable, change:
Private Sub UserName_Click () 'object name event name procedure name
If IsNull (Me) the UserName) Then 'Rem Me. UserName: refer to the current form controls the Me the attribute of the
MsgBox (" please enter your user name ")
'is used to display a message box result and returns the user response
Me. The UserName. SetFocus
'the mouse to point to in the UserName
The Exit Sub
End the If
If IsNull (Me) keyword) Then
MsgBox (" please enter your password "), vbCritical
'icon style display (vb) Red Cross (X) round icon
Me. Keyword. SetFocus
'the mouse to point to in keyword
The Exit Sub
End the If
StrSQL="select * from table 1 where the UserName='" & amp; Me. The UserName & amp; "'
"Rs. Open the STR, CurrentProject Connection, adOpenoptimistic, adLockReadOnly
If (rs (" keyword ")=keyword) Then
Me. The Visible=False
DoComd. Close 'Close the current active window
DoComd. OpenForm "table" students' open the student table form
The Else
MsgBox "the password you entered is incorrect, please enter again! Such as password forgotten, please contact the administrator "vbCritical
'icon style display (vb) Red Cross (X) round icon
End the If
Rs. Close
Set. The rs=Nothing
Me. The UserName=""
Me. Myword=""
End Sub
CodePudding user response:
Usually this tip is much End If such, suggest code indentation, can see clearlyCodePudding user response:
Run into a similar problem is done with"Every time with different parts to recompile again, 'commented until orientation to the location of the specific grammatical errors,"
The methods to solve of,