If Rs.State = 1 Then Rs.Close
Rs.Open "Select Invo_Dtl.Invo_No, Invo_Dtl.Invo_Date as _Invo_Date_, Invo_Dtl.Invo_From as _From, Invo_Dtl.Invo_To as _To, Invo_Dtl.Invo_Truck_No as Truck_No, Invo_Dtl.Invo_TP_No as TP_No, Invo_Dtl.Invo_TP_Date as TP_Date, Invo_Dtl.Invo_Amount as Net_Amount, Invo_Dtl.Invo_Load as _Loading, Invo_Dtl.Invo_Insu as Insurance, Invo_Dtl.Invo_Vat_Cst as VAT_CST, Invo_Dtl.Invo_Total from Invo_Dtl where Invo_Dtl.Invo_Date >=#" & DTPicker1.Value & "# and Invo_Dtl.Invo_Date <=#" & DTPicker2.Value & "# and Invo_Dtl.Invo_Compy = '" & Text1.Text & "' and Invo_Dtl.Invo_Customer = '" & Text2.Text & "'", con, adOpenKeyset, adLockPessimistic
If Rs.RecordCount > 0 Then
Set DataGrid1.DataSource = Rs
|