以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  窗口按钮执行公式的结果不能保存  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=85823)

--  作者:woshiabc
--  发布时间:2016/6/3 9:18:00
--  窗口按钮执行公式的结果不能保存
 在窗口某个按钮编写公式代码,最后结果保存不了,请问怎么解决?
--  作者:大红袍
--  发布时间:2016/6/3 9:18:00
--  
提示什么?贴出代码?
--  作者:woshiabc
--  发布时间:2016/6/3 9:23:00
--  
 没有错误,只是我重新打开之后,数据就变了
--  作者:大红袍
--  发布时间:2016/6/3 9:24:00
--  

看看

 

http://www.foxtable.com/help/topics/1380.htm

 


--  作者:woshiabc
--  发布时间:2016/6/3 9:38:00
--  
 不是表达式列
项目属性只读在哪里?

--  作者:大红袍
--  发布时间:2016/6/3 9:40:00
--  

 你按钮执行公式,指什么?你写了什么代码,想做什么功能?

 

 不理解你说什么项目属性只读,你可以不允许人家打开项目属性啊


--  作者:woshiabc
--  发布时间:2016/6/3 9:45:00
--  
下面是我的窗口checkbox按钮公式,你刚刚发的那个链接里面的最后一句话有写到项目属性,你可以看看。
然后我再次打开项目运费数值就变了
 Dim f As WinForm.CheckBox = e.Form.Controls("运费")
Dim r As Row = Tables("报价录入_Table1").current
If f.Checked = True Then
    If r("总体积") > 0  Then
        For Each a As Row In Tables("报价录入_Table2").Rows
            If a("QTY") IsNot Nothing Then
                a("运费") = (a("总体积")/r("总体积") * r("运费"))/a("QTY")
            End If
        Next
    Else
        For Each a As Row In Tables("报价录入_Table2").Rows
            a("运费") = Nothing
        Next
    End If
Else
    For Each a As Row In Tables("报价录入_Table2").Rows
        Dim yf As DataRow = DataTables("运费价格").Find("港口名 = \'" & r("目的港") & "\' and 装箱方式 = \'" & r("装箱方式") & "\' and 价格条款 = \'" & r("价格条款") & "\'")
        
        If yf IsNot Nothing AndAlso a("QTY") IsNot Nothing Then
            a("运费") = (a("总体积") * yf("费用1") + yf("费用2"))/a("QTY")
        End If
    Next
End If
--  作者:大红袍
--  发布时间:2016/6/3 9:48:00
--  

 已经修改保存的数据,除非你再次有代码修改其值,不然,是不可能改变数据的。

 

 上传实例说明。


--  作者:woshiabc
--  发布时间:2016/6/3 10:15:00
--  
 我把那个checkbox删掉了,然后在主档datacolchanged那里写代码:(“按体积平摊”是逻辑型)请问怎么修改才正确
Select e.DataCol.name
    Case "目的港","装箱方式","价格条款","总体积","按体积平摊运费"
        Dim yf As DataRow = DataTables("运费价格").Find("港口名 = \'" & e.DataRow("目的港") & "\' and 装箱方式 = \'" & e.DataRow("装箱方式") & "\' and 价格条款 = \'" & e.DataRow("价格条款") & "\'")
        If yf IsNot Nothing AndAlso e.DataRow("按体积平摊运费") = True AndAlso e.DataRow("总体积") > 0 Then  Then
           
            For Each a As DataRow In DataTables("报价明细").Rows
                If a("QTY") IsNot Nothing Then
                    a("运费") = (a("总体积")/e.DataRow("总体积") *( e.DataRow("总体积") * yf("费用1") + yf("费用2")))/a("QTY")
                End If
            Next
        End If
        If e.DataRow("按体积平摊运费") = False AndAlso e.DataRow("总体积") > 0
            For Each a As DataRow In DataTables("报价明细").Rows
                If a("QTY") IsNot Nothing Then
                    a("运费") = (a("总体积") * yf("费用1") + yf("费用2"))/a("QTY")
                End If
            Next
        End If       
End Select


--  作者:大红袍
--  发布时间:2016/6/3 10:19:00
--  
Select e.DataCol.name
    Case "目的港","装箱方式","价格条款","总体积","按体积平摊运费"
        Dim yf As DataRow = DataTables("运费价格").Find("港口名 = \'" & e.DataRow("目的港") & "\' and 装箱方式 = \'" & e.DataRow("装箱方式") & "\' and 价格条款 = \'" & e.DataRow("价格条款") & "\'")
        If yf IsNot Nothing AndAlso e.DataRow("按体积平摊运费") = True AndAlso e.DataRow("总体积") > 0 Then
           
            For Each a As DataRow In DataTables("报价明细").dataRows
                If a("QTY") IsNot Nothing Then
                    a("运费") = (a("总体积")/e.DataRow("总体积") *( e.DataRow("总体积") * yf("费用1") + yf("费用2")))/a("QTY")
                End If
            Next
        End If
        If e.DataRow("按体积平摊运费") = False AndAlso e.DataRow("总体积") > 0
            For Each a As DataRow In DataTables("报价明细").dataRows
                If a("QTY") <> Nothing Then
                    a("运费") = (a("总体积") * yf("费用1") + yf("费用2"))/a("QTY")
                End If
            Next
        End If
End Select