以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  父表子表关联问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=71268)

--  作者:lichinwing
--  发布时间:2015/7/8 13:50:00
--  父表子表关联问题
父表建立窗口,引用子表内容,子表不跟随一起变动怎么办?父表和子表用“款号”关联
--  作者:大红袍
--  发布时间:2015/7/8 14:05:00
--  
 什么意思?你怎样做的?什么控件?
--  作者:lichinwing
--  发布时间:2015/7/11 16:45:00
--  

在字表的CurrentChanged里面写入

 

If e.Table.Current Is Nothing Then \'如果Current为Nothing
    Return \'则返回
End If
Dim wz As Integer
Dim dr As DataRow
dr = DataTables("产品明细").Find("[款号] = \'" & e.Table.Current("款号") & "\'")
If dr IsNot Nothing Then
    wz = Tables("产品明细").FindRow(dr)
    If wz >= 0 Then
        Tables("产品明细").Position = wz
    End If
End If

 

然后在AfterLoad里面写入

Dim ids As String
For Each dr As DataRow In DataTables("图片").DataRows
    ids = ids & "," & dr("款号")
Next
ids= ids.Trim(",")
DataTables("产品明细").LoadFilter = "款号 In (" & ids & ")"
DataTables("产品明细").Load()

 

就可以了