VB实时错误 380 无效属性值,怎么改
PrivateSubAID_LostFocus()DimSQLAsStringDimrsAsNewADODB.RecordsetSQL="selectSName,SDep...
Private Sub AID_LostFocus()
Dim SQL As String
Dim rs As New ADODB.Recordset
SQL = "select SName,SDept,SPosition from StuffInfo where SID='" & Me.AID.Text & "'"
Set rs = TransactSQL(SQL)
If rs.EOF = False Then
Me.AName = rs(0) '初始化员工姓名
Me.AOldDept = rs(1)
Me.AOldPosition = rs(2)
Else
MsgBox "员工编号输入错误,或者没有这个员工!", vbOKOnly + vbExclamation, "警告!"
Me.AID = ""
Me.AID.SetFocus
Me.AID.ListIndex = 0 //定位到这一句
End If
rs.Close 展开
Dim SQL As String
Dim rs As New ADODB.Recordset
SQL = "select SName,SDept,SPosition from StuffInfo where SID='" & Me.AID.Text & "'"
Set rs = TransactSQL(SQL)
If rs.EOF = False Then
Me.AName = rs(0) '初始化员工姓名
Me.AOldDept = rs(1)
Me.AOldPosition = rs(2)
Else
MsgBox "员工编号输入错误,或者没有这个员工!", vbOKOnly + vbExclamation, "警告!"
Me.AID = ""
Me.AID.SetFocus
Me.AID.ListIndex = 0 //定位到这一句
End If
rs.Close 展开
2011-11-19
展开全部
把
Me.AID.ListIndex = 0
改为
If Me.AID.ListCount > 0 Then Me.AID.ListIndex = 0
Me.AID.ListIndex = 0
改为
If Me.AID.ListCount > 0 Then Me.AID.ListIndex = 0
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询