Hi,
I am getting the error "invalid use of null" when summing value from a range which has no value and "data type mismatch in criteria expression" when there are values to be summed up. Is there an error in my code? could someone please point out the error and why am I gettin these errors.
TQ.
I am getting the error "invalid use of null" when summing value from a range which has no value and "data type mismatch in criteria expression" when there are values to be summed up. Is there an error in my code? could someone please point out the error and why am I gettin these errors.
Code:
Private Sub cmdCalculate_Click() Dim uDT1 As String Dim uDT2 As String Dim uGT As Double uDT1 = Format(DTPicker1.Value, "dd/mm/yyyy") uDT2 = Format(DTPicker2.Value, "dd/mm/yyyy") uGT = Val(txtGT) rs.Open "SELECT Sum(AmountP) FROM tblMC where [Date] BETWEEN #" & uDT1 & "# and #" & uDT2 & "#", conn, adOpenKeyset, adLockOptimistic, adCmdText uGT = rs.Fields(0) rs.Close End Sub
Comment