老师,请帮忙看看以下代码,不能按要求查询如图1,请帮忙看看,谢谢
Dim Filter As String
With e.Form.Controls("申请单号3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = "申请单号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("材料编码3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = "材料编码 = '" & .Value & "'"
End If
End With
If Filter >"" Then
e.Form.controls("记录明细").Table.DataTable.LoadPage = 0
e.Form.controls("记录明细").Table.DataTable.LoadFilter = filter
e.Form.controls("记录明细").Table.DataTable.Load
End If
With Tables("来料检测明细_记录明细")
.Select(.RowSel, .Cols("创建日期").Index)
End With
Dim filter2 As String
With e.Form.Controls("申请单号3")
If .Value IsNot Nothing Then
If filter2 >"" Then
filter2 = filter2 & " And "
End If
filter2 = "审核单据编码 = '" & .Value & "'"
End If
End With
With e.Form.Controls("材料编码3")
If .Value IsNot Nothing Then
If filter2 >"" Then
filter2 = filter2 & " And "
End If
filter2 = "单据内容 = '" & .Value & "'"
End If
End With
If filter2 >"" Then
e.Form.controls("过程审核").Table.DataTable.LoadPage = 0
e.Form.controls("过程审核").Table.DataTable.Loadfilter = filter2
e.Form.controls("过程审核").Table.DataTable.Load
End If
With Tables("来料检测明细_过程审核")
.Select(.RowSel, .Cols("创建日期").Index)
End With

此主题相关图片如下:1.png
[此贴子已经被作者于2021/2/19 9:57:59编辑过]