该成这样:If Trim(txtusername.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
Txtsql = "select * from user_info where user_info.user_id= trim(txtusername.Text) "
Set mrc = Executesql(Txtsql, msgtext)
If mrc.EOF = True Then
MsgBox "没有这个用户,请确认并重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtpassword.Text) Then
ok = True
mrc.Close
Me.Hide
username = Trim(txtusername.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtpassword.SetFocus
txtpassword.Text = ""
End If
End If
End If
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
Txtsql = "select * from user_info where user_info.user_id= trim(txtusername.Text) "
Set mrc = Executesql(Txtsql, msgtext)
If mrc.EOF = True Then
MsgBox "没有这个用户,请确认并重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtpassword.Text) Then
ok = True
mrc.Close
Me.Hide
username = Trim(txtusername.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtpassword.SetFocus
txtpassword.Text = ""
End If
End If
End If
Dim mrc As new ADODB.Recordset;
If Trim(txtusername.Text = "") Then
改为:
If Trim(txtusername.Text) = "" Then
the operation requested by the application is not allowed if the objection is closed
"select * from user_info where user_info.user_id='" & trim(txtusername.Text) & "'"
dim rs as new ADODB.Recordset
With rs
.ActiveConnection = "DRIVER=SQL Server;" & "SERVER=(local);" & "UID=sa;" & "WSID=SOFT;" & "DATABASE=dlxt;" & "LANGUAGE=us_english"
.Source = "insert 电力能耗表(数量,日期,记录人) values(" & sl & ",'" & rq & "','" & jlr & "')"
.Open
End With