A former police officer has appeared in court charged with misconduct after allegedly having a sexual relationship with a vulnerable woman he met while leading an investigation.