日期:2014-05-16  浏览次数:20840 次

大家帮我看下,为什么老报错
Private Sub cmdMod_Click()
  Dim curdb As Database
  Dim curRS As Recordset
  Dim deviceCnt As Integer
  Set curdb = CurrentDb
  Set curRS = curdb.OpenRecordset("select * from kc where 元器件号='" & 元器件号.Value & "'")
  If Not curRS.EOF Then
  deviceCnt = curRS.Fields("库存量")
  deviceCnt = deviceCnt + CInt(进库数量.Value)
  curdb.Execute "update kc set 库存量=" & deviceCnt & _
  " where 产品号='" & 产品号.Value & "'"
  Else
  With curRS
  .AddNew
  .Fields("元器件号") = 元器件号.Value
  .Fields("库存量") = CInt(进库数量.Value)
  .Fields("存放地点") = "第一教室"
  .Update
  End With
  End If
  cmdAdd.Enabled = True
  cmdAdd.SetFocus
  cmdMod.Enabled = False
End Sub
为什么老报 用户定义类型未定义呢?谢谢大家了

------解决方案--------------------
在窗体设计中->工具->引用