Kenmore loses power

My Kenmore loses all power. There is no pattern, happens at various times. When power comes back, all lights flash. Then when you use it, it might work 30 seconds into initial cylce, might work a full cycle, might work a week as often as you want to run it, but it will just stop in the middle of washing, all lights go off, nothing you do can make it come back on. So you let it set, sometimes a few hours, all the way up to 3 weeks before the lights start flashing again.
Any ideas?

A complete model number would be helpful. If all your electrical hook-ups are sound, it sounds like a faulty control board.