rst.Open sql一直显示有个参数未指明这个问题该怎么解决

Private Sub Command15_Click()
Dim sql As String
Dim rst As ADODB.Recordset
Dim number As Integer
If IsNull(Me![仓库编号]) Then
MsgBox "请选择仓库"
DoCmd.GoToControl "仓库编号"

ElseIf IsNull(Me![商品编号]) Then
MsgBox "请选择商品编号"
DoCmd.GoToControl "商品编号"
Else
sql = "select *from 商品表 where [仓库编号]= '" & Me![仓库编号] & "'"
sql = sql & "and [商品编号]=" & Me![商品编号]
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
rst.Open sql
If Not (rst.EOF) Then
number = rst!当前库存数量
rst.Close
Set rst = Nothing
sql = "当前库存数量为:" & number
MsgBox sql
Exit Sub
Else
rst.Close
Set rst = Nothing
MsgBox "当前仓库中没有该商品库存"
Exit Sub
End If
End If
End Sub


sql

1个回答

看一下报错具体是哪一行,sql连接能打开么,拼接的sql是否正确。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问