注册 登录
编程论坛 ACCESS论坛

access 运行时错误‘3001’ 无效参数

giinthesky 发布于 2021-12-22 15:34, 1536 次点击
求助大神,我在窗体上数据录入完成后,运行程序就报错,运行到 add_rs.AddNew 这一步时就提示:运行时错误‘3001’ 无效参数,请问大神们是什么问题,该怎么处理?万分感谢!!!!

完整代码如下:

Private Sub Command0_Click()
  If IsNull(Text16) = True Then
      MsgBox "请输入车牌号码!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Text18) = True Then
      MsgBox "请输入品牌!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo30) = True Then
      MsgBox "请输入车型!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo32) = True Then
      MsgBox "请输入排量!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo34) = True Then
      MsgBox "请输入座位数!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo36) = True Then
      MsgBox "请输入所有人!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo38) = True Then
      MsgBox "请输入来源!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Text40) = True Then
      MsgBox "请输入登记日期!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo73) = True Then
      MsgBox "请输入车辆使用性质!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Text42) = True Then
      MsgBox "请输入发动机号!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Text43) = True Then
      MsgBox "请输入车辆识别号!", , "系统提示"
      Exit Sub
  End If
  If IsNull(Combo71) = True Then
      MsgBox "请输入车况!", , "系统提示"
      Exit Sub
  End If
  Dim add_db As DAO.Database
  Dim add_rs As DAO.Recordset
  Set add_db = CurrentDb()
  Set add_rs = add_db.OpenRecordset("车辆资料", dbOpenDynaset)
  add_rs.AddNew
      add_rs!车牌号码 = Me!Text16
      add_rs!品牌 = Me!Text18
      add_rs!车型 = Me!Combo30
      add_rs!排量 = Me!Combo32
      add_rs!座位数 = Me!Combo34
      add_rs!所有人 = Me!Combo36
      add_rs!来源 = Me!Combo38
      add_rs!登记日期 = Me!Text40
      add_rs!发动机号 = Me!Text42
      add_rs!车辆识别号 = Me!Text43
      add_rs!车况 = Me!Combo71
      add_rs!保险起始日 = Me!Text44
      add_rs!保险截止日 = Me!Text47
      add_rs!交强险 = Me!Text49
      add_rs!商业险 = Me!Text51
      add_rs!三者险保额 = Me!Text53
      add_rs!保费合计 = Me!Text55
      add_rs!车船税 = Me!Text57
      add_rs!保险公司 = Me!Text59
      add_rs!联系电话 = Me!Text61
      add_rs![购置价(含税)] = Me!Text65
      add_rs![折旧(元/月)] = Me!Text67
      add_rs!使用性质 = Me!Combo73
  add_rs.Update
  add_db.Close
  Set add_db = Nothing
  Set add_rs = Nothing
  MsgBox "资产添加成功!", , "系统提示"
  On Error Resume Next
    Dim ctl As Control

    For Each ctl In Me
        Select Case ctl.ControlType
        Case acCheckBox
            ctl.Value = False
        Case Else
            ctl.Value = Null
        End Select
    Next
End Sub
0 回复
1