how to work BETWEEN query by dates in Crystal Report usingvb.net
Question
Can someone help to edit this RecordSelectionFormula
? It's giving an error, something with date format...
Date value from database is:
data type = datetime (yyyy-mm-dd)
and
datetimepicker is formatdatetime(now,vbshortdate)
And my code-snippet is:
"{tblTimeLog.dtr_name}='" & cboName.Text & "' and
{tbltimelog.dtr_datelog} Between '" & DateValue(DateTimePicker1.Text) &
"' AND '" & DateValue(DateTimePicker2.Text) & "'"
The first line of my code (dtr_name to cboname
) is correct; I've checked it. But I think the problem is from filtering the date..
Solution
Change your query as
"{tblTimeLog.dtr_name}='" & cboName.Text & "' and {tbltimelog.dtr_datelog}
in '" & DateValue(DateTimePicker1.Text) & "' to '" &
DateValue(DateTimePicker2.Text) & "'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow