Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:求救:表达式计算列计数的问题

1楼
simin 发表于:2011/11/30 22:27:00
我有一个表A,有多列是一个产品的号码,有一个合计列,自动计算当这些号码列增加或减少时的个数,表达式怎么写?
2楼
czy 发表于:2011/11/30 23:44:00

将这列设为表达工列,表达式为:

 

iif([空轴_号码_A] Is Null,0,1)+
iif([空轴_号码_B] Is Null,0,1)+
iif([空轴_号码_C] Is Null,0,1)+
iif([空轴_号码_D] Is Null,0,1)+
iif([空轴_号码_E] Is Null,0,1)+
iif([空轴_号码_F] Is Null,0,1)+
iif([空轴_号码_G] Is Null,0,1)+
iif([空轴_号码_H] Is Null,0,1)

 

如此照样将其它列加进去就是了

3楼
simin 发表于:2011/12/1 0:01:00

这段代码在datacolchanging中执行后提示框关不了

If e.DataCol.Name = "经轴号" Then
    Dim dr As DataRow
    Dim Multi As String = "空轴_号码_A|空轴_号码_B|空轴_号码_C|空轴_号码_D|空轴_号码_E|空轴_号码_F|空轴_号码_G|空轴_号码_H|空轴_号码_I|空轴_号码_J|空轴_号码_1|空轴_号码_2|空轴_号码_K|空轴_号码_L|空轴_号码_M|空轴_号码_N|空轴_号码_O|空轴_号码_3|空轴_号码_5|空轴_号码_4"
    Dim Values() As String
    Values = Multi.split("|")
    For Index As Integer = 0 To Values.Length - 1
        dr = DataTables("表A").Find(Values(Index) & " = '" & e.NewValue & "'")
        If dr Is Nothing Then
                MessageBox.Show("您输入的轴号不存在!")
        e.Cancel = True
       End If
    Next
End If

4楼
czy 发表于:2011/12/1 0:15:00
If e.DataCol.Name = "经轴号" Then
    If e.DataRow.IsNull("经轴号") = False Then
        Dim n As Integer
        Dim dr As DataRow
        Dim Multi As String = "空轴_号码_A|空轴_号码_B|空轴_号码_C|空轴_号码_D|空轴_号码_E|空轴_号码_F|空轴_号码_G|空轴_号码_H|空轴_号码_I|空轴_号码_J|空轴_号码_1|空轴_号码_2|空轴_号码_K|空轴_号码_L|空轴_号码_M|空轴_号码_N|空轴_号码_O|空轴_号码_3|空轴_号码_5|空轴_号码_4"
        Dim Values() As String
        Values = Multi.split("|")
        For Index As Integer = 0 To Values.Length - 1
            dr = DataTables("表A").Find(Values(Index) & " = '" & e.NewValue & "'")
            If dr IsNot Nothing Then
                dr(Values(Index)) = Nothing
            Else
                n = n + 1
            End If
        Next
        If n > Values.Length -1 Then
            MessageBox.Show("您输入的轴号不存在!")
            e.DataRow("经轴号") = Nothing
        End If
    End If
End If
[此贴子已经被作者于2011-12-1 0:20:52编辑过]
5楼
simin 发表于:2011/12/1 0:30:00
在datacolchanged中执行提示错误n=n+1
6楼
狐狸爸爸 发表于:2011/12/1 8:16:00

我测试没有问题

[此贴子已经被作者于2011-12-1 8:18:26编辑过]
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.