有“商户资料表”、“POS机库存资料”两个表,在“POS机库存资料”添加数据时有一个下拉窗体绑定商户时我怎么实现如下功能?
首先判断该商户是否已经绑定机具。
(1)如果该商户未绑定任何机具直接绑定,弹出一个提示框提示客户机具已绑定成功。
(2)如果已经绑定机具,则执行弹出一个是否解绑选择对话框有三个选择(是、否、取消)1、选择“是”则执行解绑旧机具后重新绑定新机具;2、如果选择“否”则执行在“商户资料表”中复制并添加一个完全一样该商户然后绑定该机具 ;3、如果选择“取消”则执行取消本次操作。
有一个下拉窗体添加数据,
If e.Form.DropDownBox.name="posjishanghuIDDropBox" OrElse e.form.dropTable IsNot Nothing AndAlso e.form.dropTable.Name = "POS机库存资料"
Dim tbl As Table = Tables("入库商户选择_Table1")
Dim tbl1 As Table = Tables("POS机库存资料")
Dim Result As DialogResult
If tbl.Current IsNot Nothing Then
If tbl1.current.isnull("商户ID") = False Then
Result = MessageBox.Show("该机具已经绑定商户,是否重新绑定新商户,单击是解绑后重新绑定,单击否放弃绑定新商户", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.No Then
Return
Else
systemready = False
e.Form.DropDownBox.Value = tbl.Current("商户ID")
tbl1.Current("商户ID") = tbl.Current("商户ID")
tbl1.Current("商户名称")= tbl.Current("商户名称")
tbl1.Current("客户ID")= tbl.Current("客户ID")
tbl1.Current("客户姓名")= tbl.Current("法人姓名")
tbl.Current("机具ID")= tbl1.Current("机具ID")
tbl.Current("机具条码")= tbl1.Current("机具条码")
msgbox(tbl1.Current("商户名称") & "机具成功绑定商户 ")
systemready =True
Return
End If
End If
End If
End If