代码有错啊!
Private Sub Command2_Click()If Text17.text = "" Then
MsgBox "请输入职工编号!", , "提示"
Exit Sub
End If
Adodc1.RecordSource = "select * from 员工信息 where 职工编号 = " & Trim(Text17.text) & " "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "无记录,查询失败!", , "提示"
Exit Sub
End If
Text1.text = ""
Text2.text = ""
Text3.text = ""
Text4.text = ""
Text5.text = ""
Text6.text = ""
Text8.text = ""
Text9.text = ""
Text10.text = ""
Text11.text = ""
Text12.text = ""
Text13.text = ""
Text14.text = ""
Text15.text = ""
Text16.text = ""
Text7.text = ""
Text1.text = Adodc1.Recordset.Fields("职工编号")
Text2.text = Adodc1.Recordset.Fields("职工姓名")
Text3.text = IIf(IsNull(Adodc1.Recordset.Fields("婚姻状况")), "", Adodc1.Recordset.Fields("婚姻状况"))
Text4.text = Adodc1.Recordset.Fields("政治面貌")
Text5.text = Adodc1.Recordset.Fields("性别")
Text6.text = IIf(IsNull(Adodc1.Recordset.Fields("工种")), "", Adodc1.Recordset.Fields("工种"))
Text8.text = Adodc1.Recordset.Fields("毕业时间")
Text9.text = Adodc1.Recordset.Fields("联系电话")
Text10.text = Adodc1.Recordset.Fields("毕业院校")
Text11.text = IIf(IsNull(Adodc1.Recordset.Fields("邮箱")), "", Adodc1.Recordset.Fields("邮箱"))
Text12.text = Adodc1.Recordset.Fields("获得学位")
Text13.text = Adodc1.Recordset.Fields("进入单位时间")
Text14.text = Adodc1.Recordset.Fields("身份证号")
Text15.text = IIf(IsNull(Adodc1.Recordset.Fields("家庭住址")), "", Adodc1.Recordset.Fields("家庭住址"))
Text16.text = IIf(IsNull(Adodc1.Recordset.Fields("户口所在地")), "", Adodc1.Recordset.Fields("户口所在地"))
Text7.text = Adodc1.Recordset.Fields("籍贯")
end sub
我有一个text17 是输入职工编号用的,我数据库表中有编号为1,2,3 的三天记录,我第一次查询编号1的内容,文本框中显示,删除文本框17内的编号,输入0,那16个文本框中还是显示编号为1的员工的记录。为什么,怎么改?