So what I have here is a query that displays a Baseball players Name, Salary, and then shows normal baseball stats such as Hits, RBIs, etc. What I want to is have the code create a query at the end that will contain the player's name and and the result of an expression that looks like
IIf([H]<>0,Format(([Salary]/[H]),'$#,###.##'),0) AS Per_H
I basically want to be able to make it apply that formula to every column after their name and salary.
Right now I have
Table PlayerSal
NAME SALARY H R HR
With H being Hits, R being Runs, and HR being Homeruns. My resulting query that I want should look like this.
Player_Per
NAME Per_H, Per_R, Per_HR.
What exactly do I need to do?
Edit
I should add, yes, I know I can just input that very same function for each stat that I want to calculate it for, that isn't the point. I am trying to expand my knowledge while applying it to something that I find interesting. However, I know that this could probably be expanded to other things down the road.