What should I do if I learn that I am under investigation for a criminal charge?
If you learn that you are being investigated for some kind of criminal activity, you need to act fast. It's possible to avoid a criminal prosecution under certain circumstances. Crime victims can't file criminal charges against you, they are just witnesses who can call police and report alleged crimes. Police can't file charges against you, either. They may interrogate you, search you, and even arrest you, but they don't file charges; ultimately police have to refer the case to a prosecutor for the prosecutor's decision whether or not to file charges against you in court. So these are several points at which your lawyer can intervene to potentially prevent a life-altering prosecution from happening.
If the victim hasn't yet called police, your lawyer can talk to the victim and try to find a workable resolution to protect you. This is an extremely dangerous thing for you to do because of laws against witness tampering (a felony), so don't think that you can just call the victim and "work it out". Don't do this! I have represented people who have tried that and wound up getting charged with additional felonies for witness tampering. Let your lawyer handle it legally.
If police are already involved then you should under no circumstances interact with them. Your lawyer should talk to police immediately for a number of reasons. First, he can find out police intentions. When I am retained at this stage I make contact with police right away and ask what they're planning to do. They will usually tell me if they're still investigating the case, if they're waiting for documents or witnesses, or if they're still waiting to decide whether or not to refer the case to a prosecutor. Second, I can often make arrangements with police to avoid a surprising visit at work or at home for an arrest. A peaceful surrender, or even a no-jail, or "administrative", booking can be arranged in certain cases. Third, it's possible to persuade them not to refer the case to prosecutors at all. Although this is rare and should be considered a low probability event, it's virtually always worth trying simply because of the huge advantage of avoiding criminal prosecution when it does work.
Finally, if the case has been referred to prosecutors for filing, your lawyer can contact the prosecutor and start a dialog with them in hopes of influencing their charging decision. A complete package can be presented to the prosecutor including a detailed letter from the attorney setting forth possible defenses, technical case flaws, mitigating circumstances, polygraph or DNA results, and other critical evidence. Again, the probability of avoiding charges at this stage is never high, but it is virtually always worth trying. Don't let anyone tell you that "Nothing can be done till you are charged". That's just not true.