An accessory assists in an illegal act, although he need not be at the scene of the crime. He can be an accessory before the fact if he helps plan or set up the crime, or he can be an accessory after the fact, if, say, he helps the culprit get away.
An accomplice is a partner in crime. If he assists in a lawful enterprise, don’t call him an accomplice, call him an assistant. If he assists in a crime, he is an accomplice. An accomplice usually plays a secondary role in a crime, but as the French poet Charles Baudelaire noted that role is sometimes an essential one:
“What is irritating about love is that it is a crime that requires an accomplice.”