Foxtable(狐表)用户栏目专家坐堂 → 表A选中的值,在表B中自动选中。


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

主题:表A选中的值,在表B中自动选中。

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


加好友 发短信
等级:童狐 帖子:257 积分:2448 威望:0 精华:0 注册:2018/5/21 16:49:00
表A选中的值,在表B中自动选中。  发帖心情 Post By:2019/11/19 17:44:00 [只看该作者]

同一个窗口中有两个TABLE1,TABLE2。TABLE1和TABLE2中有一个相同的关键列,列名为A。

在Table1中选定某一行,Checked值设为真的时候,自动从TABLE2中选中A列值相同的行,也把Checked值设为真。下面的代码只能选中TABLE2中的一行,有多个行满足条件的时候,不能全部选中。帮忙修改代码

 

Dim dr As Row =Tables(e.form.name & "_table1").Current
If dr.Checked  =True Then
    dr.Checked  =False
Else
    dr.Checked  =True
End If

 

Dim tb2 As Table =Tables(e.form.name & "_table2")
With tb2
     Dim r As Integer
     r = .Find(dr("A"), .RowSel + 1, "工作号", False, False, True)
    If r > - 1 Then '如果找到符合条件的行
          .rows(r).Checked  = dr.Checked
    End  If
 End With

[此贴子已经被作者于2019/11/19 18:00:17编辑过]

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


加好友 发短信
等级:童狐 帖子:257 积分:2448 威望:0 精华:0 注册:2018/5/21 16:49:00
  发帖心情 Post By:2019/11/19 18:01:00 [只看该作者]

已成功。谢谢。

Dim dr As Row =CurrentTable.Current
If dr.Checked  =True Then
    dr.Checked  =False
Else
    dr.Checked  =True
End If
  Dim tb2 As Table =Tables(e.form.name & "_table2")

For Each r2 As Row In tb2.Rows
      With tb2
       
        If r2("A") = dr("A") Then '如果找到符合条件的行
            r2.Checked  = dr.Checked
        End  If
    End With
Next


 回到顶部