以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 跨表引用 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=114008)
|
-- 作者:lzj
-- 发布时间:2018/1/26 14:54:00
-- 跨表引用
请问大师 一个表引用另一个表的数据,两个表是通过"日期"和"期号"两列联系起来的,需要根据另一个表两列的内容(日期和期 号)来锁定行,在当前表的日期和期号两列已经有数据的情况下,用prepareEdit事件怎么安排来实现这个目的
|
-- 作者:有点甜
-- 发布时间:2018/1/26 15:25:00
--
具体一点你的问题,尽量举例说明。
锁定的逻辑是什么?截图或者上传项目。
|
-- 作者:lzj
-- 发布时间:2018/1/26 16:52:00
--
表B要引用表A 万,千,百,十,个列的数据,只能通过日期列和期号列合起来才能锁定行,因为单独一列有重复内容
|
-- 作者:有点甜
-- 发布时间: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
-- 发布时间:2018/1/27 15:14:00
--
谢谢大师的指点!!!
还有一个问题: 代码编辑器里面代码编辑了很多行以后,光标总定不了位,进度条就像弹簧,拉下去又弹了回来,想修改代码变成了不可能,这怎么解决
|
-- 作者:lzj
-- 发布时间:2018/1/27 15:18:00
--
手机拍的视频传不了
|
-- 作者:有点蓝
-- 发布时间:2018/1/27 15:30:00
--
关闭代码编辑器再重新打开。
|
-- 作者:lzj
-- 发布时间: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
|
-- 作者:有点甜
-- 发布时间:2018/1/28 14:28:00
--
没看懂你的逻辑,既然代码没问题,那就不再分割了吧,你这样的逻辑,分开来写比较简明容易修改。
|
-- 作者:lzj
-- 发布时间:2018/2/26 16:58:00
--
还是想解决上面的问题,就是:
代码编辑器里编辑了很多行后编辑不流畅甚至编辑不了,应该有解决的办法,要不就是系统缺陷
|