信息录入时,点击提交按钮,发现空值提示,但程序不能终止,数据库中仍添加了带空值的一行数据
Dim h As Row = Tables("原燃材料进厂").AddNew
h("日期")=e.Form.Controls("DateTimePicker3").Text
h("物料名称")=e.Form.Controls("ComboBox8").Text
h("当班班次")=e.Form.Controls("ComboBox9").Text
h("当班班级")=e.Form.Controls("ComboBox10").Text
h("当班进厂量")=e.Form.Controls("TextBox7").Text
h.Save
If e.Form.Controls("ComboBox8").Text = "" Then
Messagebox.show("物料名称不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If e.Form.Controls("ComboBox9").Text = "" Then
Messagebox.show("当班班次不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If e.Form.Controls("ComboBox10").Text = "" Then
Messagebox.show("当班班级不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If e.Form.Controls("DateTimePicker3").Text = "" Then
Messagebox.show("日期不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If e.Form.Controls("TextBox7").Text = "" Then
Messagebox.show("当班进厂量不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
If MessageBox.Show("信息添加成功,是否继续添加?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = 6
Forms("信息录入").open
e.Form.Controls("ComboBox8").Text = ""
e.Form.Controls("TextBox7").Value = Nothing
Else
Forms("信息录入").close
forms("启动").open
End If
[此贴子已经被作者于2013-8-1 23:00:55编辑过]