标题: 【求助】哪位好心帮个忙修改下代码,不知道出了什么问题! [打印本页] 作者: MAChens 时间: 2008-3-29 22:10 标题: 【求助】哪位好心帮个忙修改下代码,不知道出了什么问题! 代码
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Dim rst As New ADODB.Recordset
Dim strSQL As String
strSQL = "select 电话 from B where 客户名称 = " & Text0.Text
rst.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Text1.SetFocus
Text1.Text = rst("电话")
If rst("电话").Value = "" Then
MsgBox "没有该客户对应的电话!"
End If
rst.Close
Set rst = Nothing
End If
End Sub
提示 运行时错误'-2147217904 (80040e10)':
至少一个参数没有被指定值作者: Grant 时间: 2008-3-29 22:14
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Dim rst As New ADODB.Recordset
Dim strSQL As String
strSQL = "select 电话 from B where 客户名称 = '" & Text0.Text & "'"
rst.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Text1.SetFocus
Text1.Text = rst("电话")
If rst("电话").Value = "" Then
MsgBox "没有该客户对应的电话!"
End If
rst.Close
Set rst = Nothing
End If
End Sub作者: MAChens 时间: 2008-3-29 22:20
十分感谢!作者: MAChens 时间: 2008-3-29 22:34
本人是初学者,再请教下,为什么要这么改呢?