Dim ddrq_s As WinForm.DateTimePicker = e.Form.Controls("ddrq_s") Dim ordernodtp As WinForm.TextBox = e.Form.Controls("orderno") If ordernodtp.Value <> "" Then sqlwhere += "[orderno] ='" & ordernodtp.Value & "' and " End If If ddrq_s.Value <> Nothing Then sqlwhere += "[cdate] >='" & ddrq_s.Value & "' and " End If sqlwhere=sqlwhere.SubString(0,sqlwhere.LastIndexOf(" and ")) Tables("order").DataTable.LoadFilter = sqlwhere Tables("order").DataTable.Load