以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  跨表更新数据  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153232)

--  作者:朱女士
--  发布时间:2020/8/4 15:24:00
--  跨表更新数据
老师您好!
    我有一个物流表和一个价目表,想在物流表里填入物流公司和客户,重量以后,根据重量范围,查找价目表的起步费和单价,填入物流表中。我在datacolchenged中写的代码,但不执行,请指教!谢谢!
Dim pr As DataRow
Dim kh As String
Dim zd As String
Dim wl As String
Select e.DataCol.Name
    Case "物流公司","客户","重量"
        
        If e.DataRow("物流公司") Is Nothing Then
            e.DataRow("客户") = Nothing \'那么清空此行单价列的内容
            e.DataRow("单价") = Nothing
        Else
            Dim dr As DataRow
            Dim zl As Double
            
            If dr IsNot Nothing
                wl=e.DataRow("物流公司")
                zl=e.DataRow("重量")
                kh=e.DataRow("客户")
                If zl>0 And zl<=299
                    zd="j"+cstr(299)
                End If
                
                If zl>=300 And zl<=499
                    zd="j"+cstr(499)
                End If
                If zl>=500 And zl<=999
                    zd="j"+cstr(999)
                End If
                If zl>=10000
                    
                    zd="j"+cstr(999)
                    
                End If
                pr = DataTables("物流价目表").Find("[物流公司]=\'" & wl & "\'and [客户]=\'" & kh & "\'and [价格档次]=\'" & zd & "\'")
                
                e.DataRow("起步费") = pr("起步费")
                e.DataRow("单价") = pr("单价")
            End If
        End If
End Select
物流价目表的结构:
物流公司 客户    价格档次 单价 
 三志 abb j299 0.5 元/kg
三志 望变 j299 0.4 元/kg
三志 博驰 j299 1 元/kg
三志 魏德曼 j299 0.85 元/kg
三志 云变 j299 0.8 元/kg
三志 拓邦 j299 1 元/kg
三志 华变 j299 0.6 元/kg
三志 西变 j299 0.7 元/kg

--  作者:有点蓝
--  发布时间:2020/8/4 15:45:00
--  
去掉红色2句代码

           Dim dr As DataRow
            Dim zl As Double
            
            If dr IsNot Nothing