I am giving the following mentioned formula for a crystal report, but it is giving the error as 'object required'.
CrystalReport1.SelectionFormula = "IsNull({tblnewvipref.date_closed})" And Date - tblnewvipref.entry_date > 30
I am giving the following mentioned formula for a crystal report, but it is giving the error as 'object required'.
CrystalReport1.SelectionFormula = "IsNull({tblnewvipref.date_closed})" And Date - tblnewvipref.entry_date > 30
i think you have the "'s in the wrong place try this instead...
CrystalReport1.SelectionFormula = "IsNull({tblnewvipref.date_closed}) And Date - tblnewvipref.entry_date > 30"
When is this happening? As soon as the code flow hits the line mentioned, or a few seconds later when CR is trying to figure it out? [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
CCLINT
This happens as soon as the code flow hits the line mentioned.
If i remove the second condition and give the code as CrystalReport1.SelectionFormula = "IsNull({tblnewvipref.date_closed})"
then it is working fine.
Please advise.
You forgot the french brackets around the table/field name in the second condition. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
MarkSweetland:
In Vb no problem to compare like: Date1 - Date2
CR does not have a DateDiff - at least not in this form
isha, read the help you are getting close:
As budbeth said:
take out the extra quotations between: date_closed})" And Date
Add ones to the end of the statement
And, as I said, add the brackets.
Copy this exactly:
CrystalReport1.SelectionFormula = "IsNull({tblnewvipref.date_closed}) And Date - {tblnewvipref.entry_date} > 30" [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
Passing the SelectionFormula string seems to be the main problem in this case but I still don't think the syntax will work on the report. Crystal Reports has no Date() function. The Date functions available in Crystal expect an argument for conversion. Date(number), Date (string), Date (dateTime), and Date (YYYY, MM, DD). It uses CurrentDate in the newer versions to return the system date and Today in older versions. Since the SelectionFormula is parsed in the Crystal Report engine, VB Date conversions and comparisons have no effect.
Another thing to keep in mind: if the Crystal Report is saved with any predetermined SelectionFormula, the SelectionFormula used in the VB code is added to the existing SelectionFormula resulting in a narrower selection scope. It does not replace the existing formula.
CCLINT
Thanks for your suggestions. I have tried exactly as suggested by you.
CrystalReport1.SelectionFormula =
"IsNull({tblnewvipref.date_closed}) And Date - {tblnewvipref.entry_date} > 30"
But it is giving the Runtime error '20515'
Error inm formula. Not enough arguments have been given to this function.
I have also tried as suggested by MarkSweetland and it worked.Thanks, it has solved my problem.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.