以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  为什么同样的代码 同样的位置 却一个执行一个不执行、  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=43590)

--  作者:test321
--  发布时间:2013/12/11 10:09:00
--  为什么同样的代码 同样的位置 却一个执行一个不执行、
If Tables("收款明细").DataTable.DataRows.Count =0 Then
    Return
Else
    Tables("收款明细").DataTable.DeleteFor("应收金额 is null or 实收金额 is null")
    DataTables("收款明细").Save
End If

--  作者:Bin
--  发布时间:2013/12/11 10:11:00
--  
那个不执行,出现什么问题? 有详细的问题才有详细的回复.

有例子更好.

--  作者:test321
--  发布时间:2013/12/11 10:14:00
--  
这段代码放到表示件afterload里面  但是不执行  当实收金额和应收金额为空的时候 不能自动删除行
[此贴子已经被作者于2013-12-11 10:14:46编辑过]

--  作者:Bin
--  发布时间:2013/12/11 10:18:00
--  
表事件AlterLoad,只有重新加载表,也就是执行Load方法或者点击同步表的时候才会执行的.
--  作者:test321
--  发布时间:2013/12/11 10:26:00
--  
我在窗口afterload里 加入代码 datatables()。load   表事件afterload里加上上述代码 就可以了
--  作者:test321
--  发布时间:2013/12/11 10:36:00
--  

以前打开项目都是加载表全部数据  直接用内部方式进行查询数据 ,现在打开项目不加载任何数据要使用sql语句进行查询 要怎么改代码啊

 

Dim Filter As String

With e.Form.Controls("付款科目")
    If .Value IsNot Nothing Then
            Filter = Filter & "付款科目= \'" & .value & "\'"
    End If
End With
With e.Form.Controls("付款方式")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "付款方式 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("起始日期")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("终止日期")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
            Filter = Filter & "日期 <= #" & .Value & "#"
        End If
    End If
End With
With e.Form.Controls("付款账号")
If .Value IsNot Nothing Then
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "付款账号  like\'*" & .text & "*\'"
End If
End With
With e.Form.Controls("经手人员")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "经手 = \'" & .Value & "\'"
    End If
End With
If Filter > "" Then
    Tables("付款明细").Filter = Filter
End If


--  作者:Bin
--  发布时间:2013/12/11 10:37:00
--  
没区别,把*改为%  然后设置表的LoadFilter即可.
--  作者:test321
--  发布时间:2013/12/11 10:42:00
--  
LoadFilter 怎么设置?    不用sql 的select 语句吗?
--  作者:Bin
--  发布时间:2013/12/11 10:48:00
--  
http://www.foxtable.com/help/topics/1928.htm

--  作者:blackzhu
--  发布时间:2013/12/11 11:05:00
--  
你这个做法我表示有点惊讶 在表事件用


Tables("收款明细").DataTable.DeleteFor("应收金额 is null or 实收金额 is null")
    DataTables("收款明细").Save


有点不理解