主题:对象变量或 With 快变量未设置
Private Sub Command1_Click()
If Text10.Text = "" Then
MsgBox "请输上柜入数量!"
Text10.SetFocus
Exit Sub
ElseIf Val(Text10.Text) > Val(Text7.Text) Then
MsgBox "上柜数量大于库存数量"
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "请输入操作编号!"
Text1.SetFocus
Exit Sub
End If
Data1.Recordset.Edit
Data1.Recordset(4) = Val(Text7.Text) - Val(Text10.Text)
Data1.Recordset(5) = Val(Text8.Text) + Val(Text10.Text)
Data1.Recordset.Update
'修改上柜记录
Data1.Refresh
Data2.Recordset.AddNew
Data2.Recordset(0) = Text1.Text
Data2.Recordset(1) = Text2.Text
Data2.Recordset(3) = DTPicker1
Data2.Recordset(2) = Text3.Text
Data2.Recordset(4) = Val(Text10.Text)
Data2.Recordset(5) = Text11.Text
Data2.Recordset.Update
Unload Me
End Sub
调试时 Data2.Recordset.AddNew 这句错误显示 对象变量或 With 快变量未设置 错误
If Text10.Text = "" Then
MsgBox "请输上柜入数量!"
Text10.SetFocus
Exit Sub
ElseIf Val(Text10.Text) > Val(Text7.Text) Then
MsgBox "上柜数量大于库存数量"
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "请输入操作编号!"
Text1.SetFocus
Exit Sub
End If
Data1.Recordset.Edit
Data1.Recordset(4) = Val(Text7.Text) - Val(Text10.Text)
Data1.Recordset(5) = Val(Text8.Text) + Val(Text10.Text)
Data1.Recordset.Update
'修改上柜记录
Data1.Refresh
Data2.Recordset.AddNew
Data2.Recordset(0) = Text1.Text
Data2.Recordset(1) = Text2.Text
Data2.Recordset(3) = DTPicker1
Data2.Recordset(2) = Text3.Text
Data2.Recordset(4) = Val(Text10.Text)
Data2.Recordset(5) = Text11.Text
Data2.Recordset.Update
Unload Me
End Sub
调试时 Data2.Recordset.AddNew 这句错误显示 对象变量或 With 快变量未设置 错误