If Forms("窗口1").Opened Then
With DataTables("表A")
Dim r As Row = e.Table.Current
Dim s As String = "编号 = \'"& r("编号") &"\'"
If r.Isnull("姓名") Then s = "1=2"
Dim str = s & " And _Identify <> " & r("_Identify") & " And (日期 <= #" & r("日期") & "# Or 日期 Is Null)"
Dim drs As List(Of DataRow) = e.Table.DataTable.SQLSelect(str, "", "日期 Desc" )
If drs.Count > 0 Then
Forms("历史数据").Controls("TextBox1").Text = drs(0)("姓名")
Forms("历史数据").Controls("TextBox2").Text = drs(0)("地址")
Forms("历史数据").Controls("TextBox3").Text = drs(0)("日期")
...
...
...
end if