以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  逻辑值  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=46556)

--  作者:发财
--  发布时间:2014/2/25 16:15:00
--  逻辑值

Dim t As Row = Tables("收购").current()
Dim Total As Integer
Dim Amount As Double
With Tables("收购.销售")
    Total = .Compute("Sum(份数)")
    Amount = .Compute("Sum(重量)")
End With
Total = t("头数") - Total
Amount = t("重量") - Amount
If Total = 0 And Amount = 0 Then
    For Each t1 As Row In Tables("收购")
        If t1.Isnull("重量")  Then
            t1("销售已录入") = False
        Else
            t1("销售已录入") = True
        End If
    Next
   
    For Each t2 As Row In Tables("收购.销售")
        If t2.Isnull("重量")  Then
            t2("修改") = False
        Else
            t2("修改") = True
        End If
    Next
   
    With Tables("收购")
        .Position = .Rows.Count - 1
    End With
    Forms("录入销售").Close()
    Forms("录入窗口").Open()
Else
   
    MessageBox.Show("与收购不符,请修改收购!")
   
End If

为什么“销售已录入”逻辑不能正确显示?造成录入一行选true,下一行也选true.


--  作者:Bin
--  发布时间:2014/2/25 16:18:00
--  
你这代码是想做什么? 怎么循环又循环?

你的需求是什么?

--  作者:发财
--  发布时间:2014/2/25 16:23:00
--  
收购为主表,销售为关联表,当录入收购重量后,未录入销售重量时,收购的"销售已录入"为false,当录入正确的销售重量时,收购的"销售已录入"为true,销售的"修改"为true
--  作者:发财
--  发布时间:2014/2/25 16:38:00
--  

是不是我又讲不明白?请帮我修改一下!


--  作者:发财
--  发布时间:2014/2/25 16:50:00
--  

Dim t As Row = Tables("收购").current()
Dim Total As Integer
Dim Amount As Double
With Tables("收购.销售")
    Total = .Compute("Sum(份数)")
    Amount = .Compute("Sum(重量)")
End With
Total = t("头数") - Total
Amount = t("重量") - Amount
If Total = 0 And Amount = 0 Then
        If t.Isnull("重量")  Then
            t("销售已录入") = False
        Else
            t("销售已录入") = True
        End If
    
    For Each t2 As Row In Tables("收购.销售")
        If t2.Isnull("重量")  Then
            t2("修改") = False
        Else
            t2("修改") = True
        End If
    Next
   
    With Tables("收购")
        .Position = .Rows.Count - 1
    End With
    Forms("录入销售").Close()
    Forms("录入窗口").Open()
Else
   
    MessageBox.Show("与收购不符,请修改收购!")
   
End If

 

多谢提醒,我已改对了。