I want to get the data between today this the coding i used

  CrystalReportViewer1.SelectionFormula = "{sell.Date}= '" & DateTimePicker2.Value & "' BETWEEN {sell.Date}= '" & DateTimePicker1.Value & "'"

I saved the data into data

Dim date1 As Date = DateTimePicker1.Value.Date

THE ERROR I got have attached as a picture
I need help quickly as possible

Recommended Answers

All 3 Replies

Enclose date value within the pair of # (hash) if field type is Date type.

CrystalReportViewer1.SelectionFormula = "{sell.Date}>=#" & DateTimePicker2.Value & "#  and  {sell.Date}<=#" & DateTimePicker1.Value & "#"

The error I got have attached it,the tables structure also attached
In the date column the data is like this:9/26/2012 12:00:00 AM the time has alos recorded like this in every data.

    CrystalReportViewer1.SelectionFormula = "{sell.Date}>=#" & DateTimePicker2.Value & "# and {sell.Date}<=#" & DateTimePicker1.Value & "#"

avd I didn't get any errors but data is not displaying actualy it is not this coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.