Heatshiver
Registered User.
- Local time
- Today, 12:40
- Joined
- Dec 23, 2011
- Messages
- 263
I was given an Excel Workbook where I needed to breakdown some calculations for an Access database. Normally they would start simply enough, but once broken down into their basic inputs, they would be huge. I would then place them in a query and use them as such. However, I am stuck on one that is boggling my mind.
Originally, when I would place the calculation into the query, I would get the error that the text was too long:
(((SUM(((([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))*((([Feed ppg]-[Centrate ppg])/((([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))-[Centrate ppg]))*[Feed gpm])*60)/(([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))/42*(SUM((([Weight of Cyl + SF + Water (g)]-[Empty Cylinder (g)])[Total Wt of Water (g)])/[SG Base Fluid])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)]))*100)/100))/([Vol % Oil]/100))*[Daily Hrs Run])
So I decided to take parts of the calculation that were used throughout the equation and put them as separate calculations. I would then integrate those calculations back into the main equation:
(((SUM(((([Expr1])/(50-([Expr2])))*((([Expr3])/((([Expr1])/(50-([Expr2])))-[Centrate ppg]))*[Feed gpm])*60)/(([Expr1])/(50-([Expr2])))/42*(SUM((([Expr4])[Total Wt of Water (g)])/[SG Base Fluid])/(50-([Expr2]))*100)/100))/([Vol % Oil]/100))*[Daily Hrs Run])
Finally, I ensured that the correct tables and fields were being used from the database:
(((SUM(((([Expr1])/(50-([Expr2])))*((([Expr3])/((([Expr1])/(50-([Expr2])))-[tblSolidCtrlSum]![Cent Mud Wgt1]))*[tblSolidCtrlSum]![Feed Mud Wgt1])*60)/(([Expr1])/(50-([Expr2])))/42*(SUM((([Expr4])[tblSolidCtrlSum]![Total Wgt of Water (g) (CRI1)])/[tblFluidSum]![SG Base Fluid])/(50-([Expr2]))*100)/100))/([tblFluidSum]![Vol % Oil]/100))*[Daily Hrs Run])
But this gives me an invalid syntax error (an operand without an operator). I counted out the parentheses several times, and there are 28 for open and close. I even tried taking out a pair of parentheses for each "Expr#" since they would technically no longer be needed, but I get the same issue. I was thinking even the SUM could be an issue, but not sure how...
This is driving me nuts and I've already spent hours creating and trying to fix it. Can anyone please help me?? Thank you.
Originally, when I would place the calculation into the query, I would get the error that the text was too long:
(((SUM(((([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))*((([Feed ppg]-[Centrate ppg])/((([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))-[Centrate ppg]))*[Feed gpm])*60)/(([Empty Cell + Sample (g)]-[Empty Cell (g)])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)])))/42*(SUM((([Weight of Cyl + SF + Water (g)]-[Empty Cylinder (g)])[Total Wt of Water (g)])/[SG Base Fluid])/(50-([Empty Cell + Sample + Water (g)]-[Empty Cell + Sample (g)]))*100)/100))/([Vol % Oil]/100))*[Daily Hrs Run])
So I decided to take parts of the calculation that were used throughout the equation and put them as separate calculations. I would then integrate those calculations back into the main equation:
(((SUM(((([Expr1])/(50-([Expr2])))*((([Expr3])/((([Expr1])/(50-([Expr2])))-[Centrate ppg]))*[Feed gpm])*60)/(([Expr1])/(50-([Expr2])))/42*(SUM((([Expr4])[Total Wt of Water (g)])/[SG Base Fluid])/(50-([Expr2]))*100)/100))/([Vol % Oil]/100))*[Daily Hrs Run])
Finally, I ensured that the correct tables and fields were being used from the database:
(((SUM(((([Expr1])/(50-([Expr2])))*((([Expr3])/((([Expr1])/(50-([Expr2])))-[tblSolidCtrlSum]![Cent Mud Wgt1]))*[tblSolidCtrlSum]![Feed Mud Wgt1])*60)/(([Expr1])/(50-([Expr2])))/42*(SUM((([Expr4])[tblSolidCtrlSum]![Total Wgt of Water (g) (CRI1)])/[tblFluidSum]![SG Base Fluid])/(50-([Expr2]))*100)/100))/([tblFluidSum]![Vol % Oil]/100))*[Daily Hrs Run])
But this gives me an invalid syntax error (an operand without an operator). I counted out the parentheses several times, and there are 28 for open and close. I even tried taking out a pair of parentheses for each "Expr#" since they would technically no longer be needed, but I get the same issue. I was thinking even the SUM could be an issue, but not sure how...
This is driving me nuts and I've already spent hours creating and trying to fix it. Can anyone please help me?? Thank you.