• 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


  • Caroline    2019-12-03 11:23:58
  • 阅读 1266    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信