If Forms("维护").Opened Then
If e.Col.Name="进项fa piao核销" Then
If e.Row("是否抵扣二次piao") = True And e.Row.Isnull("进项fa piao核销") Then
e.Table.AllowEdit = False
Dim xmbh As String = e.Row("项目编号")
Dim sql As String="Select 项目编号,fa piao编号,开piao单位,开piao金额,二次piao使用余额 AS 使用余额 From {进项fa piao} " '基本sql语句
Dim firstPage As WinForm.TabControl = e.Form.Controls("TabControl2") '定义页控件变量
For Each page As WinForm.TabPage In firstPage.TabPages
If page.Text="进项fa piao" Then
firstPage.SelectedPage = page
sql = sql & rqzh '加日期转换为近160天以内的二次piao
Exit For
End If
Next
If e.Form.ExistControl("进项fa piao_Table") Then
e.Form.RemoveControl("进项fa piao_Table") '在这里当试图判断,tbl是否存在,如果有则删除了重建. 'firstPage.SelectedPage.RemoveControl(tbl) 如果没有
End If
'Dim tbl As WinForm.Table
Dim tbl As WinForm.Table = e.Form.CreateSQLQuery("进项fa piao_Table" ,sql ,"data_wy") '动态创建二次fa piao已过滤的与该费用申请项相同的fa piao
tbl.SetBounds(10, 10, 800, 400)
firstPage.SelectedPage.AddControl(tbl)
Tables("维护_进项fa piao_Table").ShowCheckBox = True
'设置列宽
'单元格对齐方式
'开通全局表事件
DataTables("维护_进项fa piao_Table").GlobalHandler.AfterCheckRow = True
e.Row("进项fa piao核销") ="已经填写"
'firstPage.SelectedPage.RemoveControl(tbl)
End If
End If
End If