Foxtable(狐表)用户栏目专家坐堂 → 跨表引用


  共有2909人关注过本帖树形打印复制链接

主题:跨表引用

帅哥哟,离线,有人找我吗?
lzj
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
跨表引用  发帖心情 Post By:2018/1/26 14:54:00 [只看该作者]

请问大师
     一个表引用另一个表的数据,两个表是通过"日期"和"期号"两列联系起来的,需要根据另一个表两列的内容(日期和期        号)来锁定行,在当前表的日期和期号两列已经有数据的情况下,用prepareEdit事件怎么安排来实现这个目的

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/26 15:25:00 [只看该作者]

具体一点你的问题,尽量举例说明。

 

锁定的逻辑是什么?截图或者上传项目。


 回到顶部
帅哥哟,离线,有人找我吗?
lzj
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
  发帖心情 Post By:2018/1/26 16:52:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目7.table

表B要引用表A 万,千,百,十,个列的数据,只能通过日期列和期号列合起来才能锁定行,因为单独一列有重复内容

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/26 17:01:00 [只看该作者]

Select Case e.DataCol.Name
    Case "riqi", "qihao"
        Dim dr As DataRow = e.DataRow
        Dim pr As DataRow
        If dr.IsNull("riqi") OrElse dr.IsNull("qihao") Then
            dr("wan") = Nothing
            dr("qian") = Nothing
            dr("bai") = Nothing
            dr("shi") = Nothing
            dr("ge") = Nothing
        Else
            Dim filter As String
            filter = "riqi = '" & dr("riqi") & "' And qihao = '" & dr("qihao") & "'"
            pr = DataTables("表a").Find(filter)
            If pr IsNot Nothing Then
                dr("wan") = pr("wan")
                dr("qian") = pr("qian")
                dr("bai") = pr("bai")
                dr("shi") = pr("shi")
                dr("ge") = pr("ge")
            End If
        End If
End Select

 

http://www.foxtable.com/webhelp/scr/1451.htm

 


 回到顶部
帅哥哟,离线,有人找我吗?
lzj
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
  发帖心情 Post By:2018/1/27 15:14:00 [只看该作者]

谢谢大师的指点!!!

还有一个问题:  代码编辑器里面代码编辑了很多行以后,光标总定不了位,进度条就像弹簧,拉下去又弹了回来,想修改代码变成了不可能,这怎么解决



 回到顶部
帅哥哟,离线,有人找我吗?
lzj
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
  发帖心情 Post By:2018/1/27 15:18:00 [只看该作者]

手机拍的视频传不了

 回到顶部
帅哥,在线噢!
有点蓝
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:105484 积分:536411 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/1/27 15:30:00 [只看该作者]

关闭代码编辑器再重新打开。

其次可以利用函数把代码分割开来http://www.foxtable.com/webhelp/scr/1486.htm

 回到顶部
帅哥哟,离线,有人找我吗?
lzj
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
  发帖心情 Post By:2018/1/28 10:02:00 [只看该作者]

你好大师!

    

      昨天的指点我试过了,关闭代码编辑器也不行,在代码有问题时也关不了,很麻烦。

 

      代码分割成函数,帮助里面关于函数的介绍我还理解不透,下面是一段完整的case代码,想请大师看看能不能分割,帮我分割一下,谢谢

    Case ("leixing10")
        Dim a As String="23579"
        Dim b As String=e.Row("wan")
        Dim c As String=e.Row("qian")
        Dim d As String=e.Row("bai")
        Dim g As String=e.Row("shi")
        Dim f As String=e.Row("ge")
        Dim y As Boolean=True
        Dim z As Boolean=False
        If a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "01"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500 Step 1
                    If Tables("五星5").Rows(h-sum)("leixing10")="01"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                Next
            End If
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "03"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="03"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "05"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="05"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "07"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="07"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "09"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="09"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "11"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="11"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "13"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="13"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "15"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="15"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "17"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="17"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "19"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="19"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "21"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="21"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "23"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="23"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "25"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="25"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "27"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="27"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "29"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="29"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "31"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="31"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
            e.Row("leixing10")= "02"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="02"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "04"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 250
                    If Tables("五星5").Rows(h-sum)("leixing10")="04"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "06"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="06"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "08"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="08"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "10"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="10"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "12"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="12"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "14"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="14"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "16"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="16"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "18"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="18"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "20"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="20"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "22"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="22"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "24"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="24"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "26"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="26"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
            e.Row("leixing10")= "28"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="28"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
            e.Row("leixing10")= "30"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="30"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        Else If  a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
            e.Row("leixing10")= "32"
            Dim sum As Integer
            Dim h As Integer=e.Row.Index
            If h<>0 And h-sum>0 Then
                For sum=1 To 500
                    If Tables("五星5").Rows(h-sum)("leixing10")="32"
                        e.Row("yilou10")=sum
                        Exit For
                    End If
                   
                Next
            End If
           
        End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/28 14:28:00 [只看该作者]

没看懂你的逻辑,既然代码没问题,那就不再分割了吧,你这样的逻辑,分开来写比较简明容易修改。

 回到顶部
帅哥哟,离线,有人找我吗?
lzj
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:109 积分:949 威望:0 精华:0 注册:2017/9/8 18:06:00
  发帖心情 Post By:2018/2/26 16:58:00 [只看该作者]

还是想解决上面的问题,就是:

  代码编辑器里编辑了很多行后编辑不流畅甚至编辑不了,应该有解决的办法,要不就是系统缺陷

 回到顶部
总数 11 1 2 下一页