Actually there might be an even simpler solution....
Do you have the off/on switch of the camera set to the third "hockey stick" position? You need to use that and the quick control dial on the back of the camera to change the aperture, while using the main dial up by the shutter release to change the shutter speed. (There is a custom function in some of the Canon models that allows you to swap the function of these two dials and/or to reverse their direction.)
If you just set the camera to "on", then the rear dial (aka quick dial) is disabled and won't change things.
This is also true if using one of the auto exposure modes... where the rear/quick dial serves to set Exposure Compensation. You have to have the off/on switch in the third position to allow that dial to work while in shooting modes (it will still work in the image playback modes).
I don't necessarily recommend using f22. With the high density of digital sensors, there's a problem with small apertures called "diffraction" that occurs when using small lens apertures. It sort of softens the image and there's a loss of fine detail at the smaller apertures. If I recall correctly, on the 10MP 40D the "diffraction limited aperture" is f10... smaller than that and diffraction begins to occur. It will probably be minor and unnoticable at f11, perhaps even f16 woudl be usable, but might be getting pretty strong at f22.
Set a lower ISO, rather than using a super small aperture. And, yes, a higher shutter speed will work, too...
But if trying to use a particularly slow shutter speed in fairly bright light, a smaller aperture (f11, f16) and the lowest ISO setting (100) might not be enough. In that case, you might need a good quality Neutral Density filter to further reduce the light reaching the camera's sensor. These come in various strengths reducing one stop, two stops, 3 stops, 5 or 6 stops, even 9 or 10 stops of light. (often stated 0.30 for one stop, 0.60 for two, 0.90 for three, etc.). A good quality filter will be very neutral gray so it doesn't add any color tint to an image. I'd recommend a multicoated filters, such as the B+W MRC here.
In M mode, you should use the camera's meter readout scale on the top LCD or shown in the viewfinder... adjust your combination of settings (ISO, shutter speed and aperture) until the indicator is centered. Alternatively, you can use a separate handheld meter to determine your settings. Or in many common lighting conditions simply learn to set them by eye (Sunny 16 Rule). Note that when using any of the Auto Exposure modes (Av, Tv, P) the scale on the top LCD or in the viewfinder serves to indicate Exposure Compensation, not the same meter readout shown in M mode.