我以前问过类似的问题,只能用代码,参考以下代码,改改就行
DataColChanged事件
If e.DataCol.Name = "入库日期" OrElse e.DataCol.Name = "出库日期" Then
If e.DataRow.IsNull("入库日期") = False AndAlso e.DataRow.IsNull("出库日期") = False Then
e.DataRow("库存天数") = DateDiff("d",e.DataRow("入库日期"),e.DataRow("出库日期"))
Else
e.DataRow("库存天数") = Nothing
End If
End If