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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad date format string

Status
Not open for further replies.

jcl5

IS-IT--Management
Dec 6, 2002
89
0
0
GB
Hi

Using oracle 8 and Crystal 10

I have a report which stores only month and year (as numbers) and I need to perform a calculation based on the last day of that month field.

I have converted it using the following formulas:-
@GVAToDate
cdate(({GVA.YEMONTH}&'/'&{GVA.YEAR}))

@LastDay
dateserial(year({@GVAToDate}), month({@GVAToDate})+1,01)-1

This seems to work fine when running the report through the designer.
When I publish it through Enterprise I get error:-

Errors Occured When Refreshing Report.
-2147191654 - Bad date format string. - Logon To Server is OK - Reading Records

Can anyone help?

Thanks

jcl5
 
Try:

dateserial({GVA.Year},{GVA.yemonth}+1,01)-1

-LB

 
Sorry lbass, doesn't make any difference. I think the formula is ok, it produces the correct results, it just returns the error through enterprise.
 
Then I would try the Crystal Enterprise forum.

-LB
 
Dateserial works on our CE 10 just fine, as does Oracle 8.

Anyway, try the following instead:

if isdate({@GVAToDate}) then
totext(Dateadd("m",1,{@GVAToDate})-1)
else
"Bad date format"

This eliminates the dateserial (which I doubt is the issue) and it checks for bad data format.

If that works, you might also try:

if isdate({@GVAToDate}) then
totext(dateserial(year({@GVAToDate}), month({@GVAToDate})+1,01)-1)
else
"Bad date format"

The issue appeared to be a null or bad value in a field to me, your formulas seemed fine.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top