Deorwin Bensurto Deorwin Bensurto - 7 months ago 17
Vb.net Question

how to work BETWEEN query by dates in Crystal Report usingvb.net

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..

Answer

Change your query as

"{tblTimeLog.dtr_name}='" & cboName.Text & "' and {tbltimelog.dtr_datelog}
in '" & DateValue(DateTimePicker1.Text) & "' to '" & 
DateValue(DateTimePicker2.Text) & "'"