I have facing problem with vb6 and crystal report 8 . The error message is "Runtime error '20534' : Error detected by database dll". If i remove the red color line. It don't have any error.

Private Sub VIButton15_Onclick()
If docheck = True Then

Call clearReport

If optSearch(0).Value = True Then
Report.SelectionFormula = "{Sales.Receiptno} >='" & txtfrom & "' and {Sales.Receiptno} <='" & txtTo & "'" & temp
End If
If optSearch(1).Value = True Then
Report.SelectionFormula = "{Sales.Salesdate} >=" & changerptdate(txtfrom) & " and {Sales.Salesdate} <=" & changerptdate(txtTo) & temp
End If



Report.ReportFileName = Reportpath & "\CustomSales\10Topsalesbyitems.rpt"

Report.Formulas(0) = "company ='" & Branchid.Text & "'"
Report.Formulas(1) = "DateRange ='Sales Date from " & txtfrom & " to " & txtTo & "'"

Report.Action = 1

End If
End Sub