I still can't get this to work in Crystal Reports, but it works fine in VB. When I try call the report I get the following message;
Seagate Crystal Reports Database Error:
"You tried to execute a query that does not include the specified expression 'PrkFee' as part of an aggregate function."
Here is my exact SQL statement and when I check the values for each field in the VB window they are correct, however, as soon as I get to the line of code that calls Crystal Reports I get the above error.
sql = "select cash.code, cash.date, cash.totcash, sum(payment.PrkFee), sum(payment.CrdFee), sum(payment.LkrFee),
sum(payment.pst), sum(payment.gst) FROM cash, payment WHERE cash.code = payment.userID AND payment.trnsdte = #" & CDate(txtDate) & "# AND cash.date = #" & CDate(txtDate) & "# AND cash.code <> 'BK' GROUP BY cash.code, cash.date, cash.totcash"
The problem is I don't know what to insert on my report to get this to work. I tried inserting all the database fields from the payment table and then writing a formula to total them, but it didn't work. The report has to be called from Visual Basic.
FYI - I can't do it as a sub-report because of the way the information needs to appear.
Thanks again for your help!!!