Thanks, I added the format out of desperation to get the code to work. I have taken the format away but the code isn't doing what I want. It looks like the ORDER BY isn't working or there is something else incorrect.
As you can see in the screenshot below, Average_Cost_Price on the highlighted...