error in viewing a report
hi,,
i have this code for viewing a report from my application but when i run the program and click on the report buttin i get this error:
report not found..
the kine colored in red is the one that i get the error in:
Code:
Private Sub Command1_Click()
CrystalReport1.ReportFileName = App.Path & "rent.rpt"
CrystalReport1.DiscardSavedData = True
CrystalReport1.RetrieveDataFiles
CrystalReport1.ReportSource = 0
CrystalReport1.SQLQuery = "select * from rent order by {serial}"
CrystalReport1.WindowTitle = "Rent system"
CrystalReport1.Destination = crptToWindow
CrystalReport1.PrintFileType = crptCrystal
CrystalReport1.WindowState = crptMaximized
CrystalReport1.SelectionFormula = "IsNull({Document.rent})"
CrystalReport1.Action = 1
End Sub
any help please?
Re: error in viewing a report
App.Path does not include an ending \ (unless the app is in the root directory of a drive). Add a \ to the file name.
CrystalReport1.ReportFileName = App.Path & "\rent.rpt"
Re: error in viewing a report
i did what you told me and i get this error :
error in formula:( the error is in red)
Code:
Private Sub Command1_Click()
CrystalReport1.ReportFileName = App.Path & "\rent.rpt"
CrystalReport1.DiscardSavedData = True
CrystalReport1.RetrieveDataFiles
CrystalReport1.ReportSource = 0
CrystalReport1.SQLQuery = "select * from rent order by {serial}"
CrystalReport1.WindowTitle = "Rent system"
CrystalReport1.Destination = crptToWindow
CrystalReport1.PrintFileType = crptCrystal
CrystalReport1.WindowState = crptMaximized
CrystalReport1.SelectionFormula = "IsNull({Document.rent})"
CrystalReport1.Action = 1
End Sub
Re: error in viewing a report
can someone help me please?
Re: error in viewing a report
What is the code for your formula?
That would appear to be what Crystal doesn't like, but as I don't know what that code is, I can't, at the moment, offer any suggestions.
Re: error in viewing a report
You specified Document.Rent in the formula. Document is the table name and Rent is the field name. Document is not a table in your Selection formula. Rent is however.
Should the formula be
CrystalReport1.SelectionFormula = "IsNull({Rent.rent})"
or
CrystalReport1.SelectionFormula = "IsNull({Rent.????? Some other field})"