I thought I posted this already, but I can't find the thread...I'm using CR 12 with a SQL Server 2005 database. I created the main report using the wizard and selecting the appropriate tables and fields. For the subreport, I needed to do some extra manipulation, so I chose to "Add Command" from the same ODBC connection used in the main report. When I run the entire report, it pops up a window asking for a database login. If I suppress the subreport, this doesn't happen. I know there are other posts in here dealing with this topic, but none of them seem to deal with SQL code in Crystal. Is there a way to add the login information into this command so it doesn't prompt for a login every time?
I added the USE dbname at the top, hoping it would use the same permissions from the main report, but that didn't work.
Thanks for any help.
Code:
USE dbname
SELECT OpenJob.JobN,
CASE WHEN OpenJob.JobN between 0 AND 199999 THEN 'STL'
WHEN OpenJob.JobN between 300000 AND 399999 THEN 'HC'
WHEN OpenJob.JobN between 400000 AND 499999 THEN 'TOR'
ELSE 'HC'
END AS 'Loc',
CASE WHEN OpenJob.ProductCode IN (310,315,350) THEN 'Product1'
WHEN OpenJob.ProductCode IN (28,48) THEN 'Product2'
WHEN OpenJob.ProductCode = 810 THEN 'Product3'
WHEN OpenJob.ProductCode IN (610,620) THEN 'Product4'
WHEN OpenJob.ProductCode IN (29,36,39) THEN 'Product5'
WHEN OpenJob.JobN between 0 AND 199999 THEN 'Product6'
ELSE 'Product7'
END AS 'LOB',
CASE WHEN CT_OTD.OnTime = 'Yes' THEN 1
ELSE 0
END AS 'OnTime',
CASE WHEN CT_OTD.OnTime = 'No' THEN 1
ELSE 0
END AS 'Late',
CASE WHEN CT_OTD.LateCategory = 'XXDeficiency' THEN '1'
ELSE 0
END AS 'XXDef',
CASE WHEN CT_OTD.LateCategory = 'YYDeficiency' THEN '1'
ELSE 0
END AS 'YYDef',
OpenJob.ShippedDate
FROM OpenJob, CT_OTD
WHERE OpenJob.JobN=CT_OTD.JobN
AND CT_OTD.Component <> 1
AND CT_OTD.OnTime <> ' '
I added the USE dbname at the top, hoping it would use the same permissions from the main report, but that didn't work.
Thanks for any help.