Dim filter As String filter = iif(Tables(e.Form.name & "_table1").Filter>"", Tables(e.Form.name & "_table1").Filter,"1=1") Dim sql As String = "select * from {表A} where " & filter filter = iif(Tables(e.Form.name & "_table2").Filter>"", Tables(e.Form.name & "_table2").Filter,"1=1") sql = "select a.第二列, b.第二列 from (" & sql & ") a inner join (select * from {表B} where " & filter & ") b on a.第一列 = b.第一列" msgbox(sql) Tables(e.Form.name & "_table3").Fill(sql, True)
|