老师,下面是菜单按钮控件代码,其意思是点击此按钮时,将HTB1指定的列复制到XMJDB1,HTB1中列“HTBH”是唯一的,原来的按钮是是没有限制复制次数的,现在要增加条件,就是如果已经复制行到XMJDB1,如果XMJDB1的“ND”“YF”为空时,则相同的行不能再从HTB1复制到XMJDB1,这样就避免当月因误点按钮重复在XJMJDB1生成数据行。代码如下,现在如何在黄色代码处加上条件代码呢??请老师指导
If User.IsRole("经办人") Then
For Each r As Row In Tables("HTB1").Rows
If r("XZH") = True Then
Dim dS As DataRow
dS = DataTables("HTB").Find("HTBH = '" & e.DataRow("HTBH") & "'" ) ‘在XMJDB1里查找HTBH
If dS Is Nothing '如果找到, 则设置各列内容
判断XMJDB1的“ND”“YF”列为空的代码 就是在XMJDB1里找到合同编号且没有“ND”“YF” 为空的行时,复制下列列到XMJDB1,否则提示“本月已经。。。。。”
Dim nma() As String = { "XMLB","XMBM","XMMC","HTBH","HTMC","KSJM","KSMC","FYDL","HTFYLB","HTJE","LJZFGCK","分项名称","YZFYFK","YFJK" } 'A表数据来源列
Dim nmb() As String = { "XMLB","XMBM","XMMC","HTBH","HTMC","KSJM","KSMC","FYDL","FYLB","HTJE","LJYFJDK","分项名称","YFGCK","GCJK" } 'B表数据接收列
Dim dr As DataRow = DataTables("XMJDB1").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = r(nma(i))
Next
End If
Next
End If
[此贴子已经被作者于2015/3/27 15:44:19编辑过]