Well, I don't shoot digital nor do I shoot Nikon. I'm strictly Canon film, but I do know that both brands have similar "modes" to help you.
I use AV a lot (which is aperture priority, which means I can adjust the aperture and the camera chooses the shutter). You could do it that way. If you're shooting in low light with no flash, crank open that apterture. Like no more than f3. The bigger the aperture (the smaller the number), the more ambient light will be able to hit the sensor.
In TV (or shutter speed priority, you choose the shutter and the camera chooses the aperture) you can set it high and freeze action, but be careful, watch the aperture because if it is too small (the higher the number) it'll let in less light and come out really underexposed.
One of those 2 modes will be better than doing what you're doing. I only use natural light as a flash is a little too expensive for me right now and to be honest, I love using nothing but ambient light. Again, I believe the mode names are different on a Nikon, but the functions are the same, you might want to read your manual. Someone else might be able to help you out more with the Nikon d40 and be able to give you more info on shutter speed. I haven't worked in TV mode very much...