sql一直显示有个参数未指明这个问题该怎么解决
sql一直显示有个参数未指明这个问题该怎么解决<p>Private Sub Command15_Click()
Dim sql As String
Dim rst As ADODB.Recordset
Dim number As Integer
If IsNull(Me![仓库编号]) Then
MsgBox "请选择仓库"
DoCmd.GoToControl "仓库编号"</p><p>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</p>
最好把报错贴上来 看一下报错具体是哪一行,sql连接能打开么,拼接的sql是否正确。 看下日志,定位一下错误原因 检查下sql 没错啊
页:
[1]