Click here to Skip to main content
14,735,523 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using VS2019,CR13
rpt.Load("CrystalReport1.rpt")
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
        For Each myTable In rpt.Database.Tables
            myLogin = myTable.LogOnInfo
            myLogin.ConnectionInfo.ServerName = Application.StartupPath & 
            "\NewIraqDB.mdb"
            myLogin.ConnectionInfo.UserID = "admin"
            myLogin.ConnectionInfo.Password = "723"
            myTable.ApplyLogOnInfo(myLogin)
        Next
        If CheckBox1.Checked = True Then
            rpt.RecordSelectionFormula = "{table1.locationP}='" & a & "' and 
            {table1.dateW}>='" & c1 & "' and {table1.dateW}<='" & c2 
            & "' and  {table1.timeprint}>='" & time1.Value.ToString("h:mm:ss 
            tt") & "' and {table1.timeprint}<='" & 
            time2.Value.ToString("h:mm:ss tt") & "'                                                                        "
        Else
            rpt.RecordSelectionFormula = "{table1.locationP}='" & a & "' and 
           {table1.dateW}>='" & c1 & "' and {table1.dateW}<='" & c2 & "'"
        End If
        print1.CrystalReportViewer1.ReportSource = rpt
        print1.CrystalReportViewer1.RefreshReport()
        print1.ShowDialog()

problem with RecordSelectionFormula line error in timeprint
This image shows the error

What I have tried:

I'm trying to print records in crystall report between two times from timeprint filed
this my access database
Posted
Updated 10-Nov-20 4:55am
v3
Comments
Gerry Schmitz 10-Nov-20 11:44am
   
Put in a break point and see that "table1" actually contains "timeprint".

For all we know, "table1" is just a query where you forgot to include "timeprint".
CHill60 10-Nov-20 13:24pm
   
I don't know why you have highlighted those timeprint items - the error is saying that there is no field called errorkind - have a look at the way you have defined CrystalReport1.rpt. Alternatively comment out the entire If-Else section (i.e. don't attempt to set any RecordSelectionFormula at all) and see if the error is still reported

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900