Here is my quick schematic of how to do what you want:
VERY IMPORTANT!
The diode is there to prevent any current from interacting with the volume pot. Without it some of the high frequencies will be grounded, so you will loose some tone. There are rare cases where this is desirable, but that is not too often. Use use any very very low voltage diode here, even an LED would work.
A micro switch (small, two way) will do the job nicely. I am considering doing this mod to my P-Bass, so I will let you know how I get on once its done (if its done).