You can use media in the sump for added biological filtration. Many people who use less rock in their displays do this.
Generally you'd want to add the rock, then the sand, then the water. You add the water slowly, using a bowl, or platter, or something to keep it from stirring the sand up too much. You do not have to do it this way, but it clouds up less and clears up quicker.
Yes you can mix your first batch of water directly in the tank. But since you have a 40 you can get a couple of 5 gallon buckets (you'll need them anyway) and make up some water before hand. Then after placing your sand and rock you can add some water.
Rock first, then sand. If the rock is sitting on top of the sand critters that burrow can dig under the rock and cause instability/collapse.
Also, please be aware, I am not an expert. I am on these forums asking questions every day. It just so happens that the questions you are asking are ones I have already researched.
Good luck!