If e.DataCol.Name = "月份" Then
If e.NewValue Is Nothing Then
e.DataRow("期初数量") = Nothing
Else
Dim dr As DataRow
dr = DataTables("产品").Find("[月份] = \'" & e.NewValue - 1 & "\'")
If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("期初数量") = dr("期末数量")
End If
End If
End If