Private Declare Function GetUserName Lib "advapi32. DLL" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize) As Long As Long
Public OK As Boolean
'the number of records to determine
Dim miCount As Integer
Private Sub Form_Load ()
Dim sBuffer As String
Dim lSize As Long
SBuffer=Space $(255)
LSize=Len (sBuffer)
Call GetUserName (sBuffer, lSize)
If lSize & gt; 0 Then
TxtUserName. Text=""
The Else
TxtUserName. Text=vbNullString
End the If
OK=False
MiCount=0
End Sub
Private Sub cmdCancel_Click ()
OK=False
Me. Hide
End Sub
Private Sub cmdOK_Click ()
Dim txtSQL As String
Dim MRC As ADODB. You
Dim MsgText As String
'ToDo: create test for correct password
'check for correct password
The UserName=""
If the Trim (txtUserName. Text="") Then
MsgBox "not this user, please enter the username again!" , vbOKOnly + vbExclamation, "warning"
TxtUserName. SetFocus
The Else
TxtSQL="select * from user_Info where user_ID='" & amp; TxtUserName. Text & amp; "'
"The Set MRC=the ExecuteSQL (txtSQL MsgText)
If MRC. EOF=True Then
MsgBox "not this user, please enter the username again!" , vbOKOnly + vbExclamation, "warning"
TxtUserName. SetFocus
The Else
If the Trim (MRC) Fields (1))=Trim (txtPassword. Text) Then
OK=True
MRC. Close
Me. Hide
The UserName=Trim (txtUserName. Text)
The Else
MsgBox "input password is not correct, please input again!" , vbOKOnly + vbExclamation, "warning"
TxtPassword. SetFocus
TxtPassword. Text=""
End the If
End the If
End the If
MiCount=miCount + 1
If miCount=3 Then
Me. Hide
End the If
The Exit Sub
End Sub
Private Sub Text1_Change ()
End Sub
Private Sub Label3_Click ()
End Sub
Private Sub Label4_Click ()
End Sub
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
If MRC. EOF=True Then
Run to this step, "real-time error '91' object variable or variables WITH block is not set"
Should be how to solve, thank you
CodePudding user response:
Where is your Connection object? The ExecuteSQL do?