Keep in mind that the user is under no real obligation to accept any answer. It's encouraged, but it's entirely at his discretion. I would argue that telling a user to "accept my answer" is a little badgering, at least if it's presented so bluntly. I'd interpret it as "give me teh repz" just as much as the users who post "give me teh codez" questions. (Though I'd be lying if I said I didn't leave such comments somewhere in the distant past.)
Having said that, I agree that the user should post separate questions. There are cases where a question can evolve over time and no longer reflect the original question, and whether any particular case fits that scenario is entirely subjective.
I think the best approach would be to explain to the user the difference between the two separate issues and help them create two discrete questions outlining each one. There's certainly no moral obligation, but it's good for the community in general and would certainly serve to help the user distinguish between separate actions in the code (as opposed to copying/pasting some code block without any knowledge of what it does or why it's failing, which many times is what brings them here).
Maybe modify your answer to further demonstrate the discrete nature of the solution you provided. Show code which removes the other problem and focuses on the specific problem. Then in a comment suggest that the user isolate the separate problem in a similar way as another question.
There's certainly no guarantee that the user will abide by such advice. They may very well just say, "I still get another error, this didn't fix my program" and leave Stack Overflow in a huff. But there's nothing any of us can really do about that.