Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting records

Status
Not open for further replies.

leetprog

Programmer
Jan 27, 2004
12
BE
Hello,
I'm having trouble selecting records from VB code. My code so far is this:

Dim rap As ReportDocument = New ReportDocument
rap.RecordSelectionFormula = "year({@Order}) = 2004 and month({@Order}) = 3"
rap.Load(Replace(Application.StartupPath, "\bin", "") & "\reports.rpt")
CRViewer.ReportSource = rap


@order is a formula that i created in crystal reports. I also tried a normal database field but it still didn't work. It always says:

An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LoadSaveReportException' occurred in crystaldecisions.crystalreports.engine.dll

Additional information: Invalid report file path.


I know the file path is correct! So I think the RecordSelectionFormula is wrong. I also tried to leave this selection and then it works, but then it gives the wrong information.

TIA
 
just to make sure your path is correct, try this:

Code:
s=Replace(Application.StartupPath, "\bin", "") & "\reports.rpt"

msgbox s

rap.Load(s)
when the message box comes up, veriffy its path
 
Hi!
Yes, I tried that, and the path is correct. I know there is something wrong with the ".RecordSelectionFormula".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top