各位老师,我现在遇到的问题,我在datcolchanged事件中,写了一段代码,又在一个模式窗口中写了相同功能的代码,当开始时间>结束时间的时候,会提示两次的messagebox,我想着能不能再两地都触发的时候,只执行模式窗口的代码。
datacolchangged代码:
Dim r As Row=Tables("育苗计划.育苗计划明细").current
Dim v1 As Date =r("开始时间")
Dim v2 As Date =r("结束时间")
If r("开始时间") <> Nothing And r("结束时间") <> Nothing Then
If v2 < v1 Then
messagebox.show("结束时间不能早于开始时间!","提示")
r("结束时间")= Nothing
End If
End If
模式窗口:
Dim v1 As Date = e.Form.controls("dt1").value
Dim v2 As Date = e.Form.controls("dt2").value
If v1 < > Nothing And v2 <> Nothing Then
If v2 < v1 Then
messagebox.show("结束时间不能早于开始时间!","提示")
e.form.controls("dt1").value = Nothing
End If
End If