Results 1 to 3 of 3

Thread: selection formula error date help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    13

    selection formula error date help

    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

    Code:
    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

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    13

    Re: selection formula error date help

    i already solve the first part using this code
    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

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

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: selection formula error date help

    Quote Originally Posted by syntax101
    but i want to add another field which is shift but it will return an error
    What is the error?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width