http://www.nikonchat.com/nikon-nikkor-manual-lens/

How I can turn my flash on my Nikon D40 when you use an old Nikkor 50mm 1.8 lens?
Of course with a goal in a D40 allows me to use manual mode only. That's fine … but without flash? It seems you can not use my flash.
I think the camera requires that the lens has a chip that works with a TTL flash (requires information from the objective to be fed back to the camera.) That said, the D40 flash can be used in manual flash mode. Only you have to go into the menu system, select the pencil, and then select the menu 14, manual flash. You can then select the flash: Full, 1.2, 4.1, etc. FYI, the flash guide number is 55 feet at ISO 200. That is, at full power, take 55 and divide by the distance to get their flash opening. (Subject Example. Is 10 feet away. 55/10 = 5.5 or select 5.6) Obviously, changes in opening if the object is closer / farther, ISO is different, or using less than full power. You'll have to manually raise the flash by pressing the button. Hope this helps!