Originally posted by David P The pentax k x will not keep the setting when the battery is taken out.
If it eats up the batteries fast as well, it might be the capacitor giving up. If this is the case, take a look at this thread here-under, post No 82, it might give you some ideas. If that does not help, the next step would be a capacitor replacement (330V and I forgot how many μF) Not a complicated task for a person with basic soldering skills.
https://www.pentaxforums.com/forums/6-pentax-dslr-discussion/13335-ist-dl-batteries-6.html
If it just looses settings, it might be that the small round battery on the motherboard is dead. It can be replaced but it needs a gentle hand because it's glued in place. I've never replaced this one on Pentax but if you decide to play with it at some point, I can see the characteristics if indicated on it.