下面这段按钮代码,是将a表中变动时间最近的单位,填充到b表的对应单元格,如果按小于等于日期输入框时间所在的单位进行填充,代码应该如何修改,请各位老师指教,谢谢!!
Dim ny As Date
ny = e.Form.Controls("DateTimePicker1").Value
For Each dr As DataRow In DataTables("b").DataRows
Dim pr As DataRow
If dr.IsNull("姓名") Then
dr("单位") = Nothing
Else
pr = DataTables("a").Find("姓名 = '" & dr("姓名") & "'", "变动日期 Desc")
If pr IsNot Nothing Then
dr("单位") = pr("单位")
End If
End If
Next
[此贴子已经被作者于2013-4-19 16:45:53编辑过]