增加红色部分代码后
文本框为空时代码起作用
文本框不为空时AddNew不起作用
错在哪,应怎样修改
自己发现问题TextBox5应改TextBox1
谢谢大家
Dim r As Row = Tables("商品资料表").Current
If r Is Nothing Then
msgbox("没有该商品")
Else
If Forms("入库窗口").Controls("TextBox5").Text ="" Then
Return
'返回
Else
Dim ndr As DataRow = DataTables("商品入库表").AddNew
ndr("商品号") = r("商品号")
ndr("商品名") = r("商品名")
ndr("条形码") = r("助记码")
ndr("助记码") = r("助记码")
ndr("自编码") = r("自编码")
ndr("规格") = r("规格")
ndr("单位") = r("单位")
ndr("生产单位") = r("生产单位")
ndr("单位") = r("单位")
ndr("批文") = r("批文")
ndr("入库号") = e.Form.Controls("TextBox2").text
ndr("数量") = e.Form.Controls("TextBox3").text
ndr("单价") = e.Form.Controls("TextBox4").text
ndr("入库金额") = e.Form.Controls("TextBox5").text
ndr("入库日期") = e.Form.Controls("DateTimePicker1").Value
End If
End If
[此贴子已经被作者于2014-7-13 11:05:56编辑过]