铵钮代码如下:
If _UserGroup = "物流部" Then
With Tables("水洗")
If .Current IsNot Nothing Then
If Tables("水洗").Current("确认")=False
With e.Form
If .Controls("Label5").Text = "OK" Then '如果信息完善,则新建令号
Dim Filter As String
With e.Form.Controls("TextBox4")
If .Value IsNot Nothing Then
Filter = "生产条码 = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("织机生产").Filter = Filter
End If
With Tables("织机生产")
If .Current IsNot Nothing Then
Dim tr As Row = Tables("织机生产").Current()
tr("水洗批次") = .Controls("TextBox1").Value
tr("水洗_载货日期") = .Controls("DateTimePicker2").Value
tr("水洗_单位") = .Controls("ComboBox1").Value
tr.Save()
Else
MessageBox.show("没有这条记录!")
End If
End With
End If
End With
Else
MessageBox.show("本批次已确认完成,不可再添加!")
End If
Else
MessageBox.show("目录表没有记录!")
End If
End With
Else
MessageBox.show("物流部才能操作!")
End If
原代码筛选后记录如果为空,再执行数据填充会报错。我就在筛选后加个记录为空不执行的代码,不知为什么加不了,会报错!