PDA

Click to See Complete Forum and Search --> : selection formula error date help


syntax101
Apr 29th, 2008, 01:57 AM
i want to display all datas with the selected date im using calendar month
but it gives me an error

Conversion from string "{daily.daily_datemilled} = 4/17/" to type 'Date' is not valid.

and if i change

" Dim mySelectFormula As Date" to "Dim mySelectFormula As String" the erros is Date is required here

Private Sub cal_daily_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles cal_daily.DateSelected

Dim s As Date = e.Start

s = CType(s.ToShortDateString, Date)
MsgBox(s)

Dim mySelectFormula As Date = "{daily.daily_datemilled} = " & s

Report.CrystalReportViewer1.SelectionFormula = mySelectFormula
Report.CrystalReportViewer1.ReportSource = New CrystalReport5
Report.CrystalReportViewer1.Zoom(75)
Report.CrystalReportViewer1.Refresh()
Report.CrystalReportViewer1.RefreshReport()
End Sub

syntax101
Apr 29th, 2008, 03:56 AM
i already solve the first part using this code
mySelectFormula = "{daily.daily_datemilled} In DateValue ('" & s & "') To datevalue('" & s & "')"

but i want to add another field which is shift but it will return an error

mySelectFormula = "{daily.daily_datemilled} In DateValue ('" & s & "') To datevalue('" & s & "') and {daily.daily_shift} =" & cb_shift.Text

Hack
Apr 29th, 2008, 07:07 AM
but i want to add another field which is shift but it will return an errorWhat is the error?