...My question is, can the 40D give detailed images like the D80 by just adding a few notches on the sharpness?
Yes. The reason is that both sensors have the same number of pixels and so, with good glass, give the same resolution.
Anyway, now that compact flash cards are so capacious there is every reason to shoot in RAW +
Large Fine JPEG. If for any reason you don't like the processing used to produce the JPEG, and that is fully adjustable in the 40D, then re-process using the RAW data. Canon's supplied (free) software makes downloading and working with RAW files a breeze and, as with most cameras, there are lots of third party tools out there as well.
Don't forget that, while the camera body is the big part of the initial purchase, in time your major investment is likely to be in the lens system and accessories as bodies are usually upgraded. If the D80 and 40D are neck and neck then do have a careful look at the lenses you are likely to buy in the future and decide which system suits best.