先判断一下字段值是否为空: If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext if not isnull(Adodc1.Recordset.Fields("交工日期")) then DTPicker1.Value = Adodc1.Recordset.Fields("交工日期") end if if not isnull(Adodc1.Recordset.Fields("竣工日期")) then DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期") end if end if
If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext
if not isnull(Adodc1.Recordset.Fields("交工日期")) then
DTPicker1.Value = Adodc1.Recordset.Fields("交工日期")
end if
if not isnull(Adodc1.Recordset.Fields("竣工日期")) then
DTPicker2.Value = Adodc1.Recordset.Fields("竣工日期")
end if
end if