Who is the one who does something:
Who drank all the beer?
Whom is the one who has something done to him.
It was his roommate whom he accused of drinking all the beer.
Whom also typically comes after a preposition, as in to whom, from whom, with whom, etc. However, whom is considered formal, and many people don’t bother with it these days, using who in place of whom:
It was his roommate who he accused of drinking all the beer.
Most avoid the problem altogether by modifying their sentences:
He accused his roommate of drinking all the beer.
See the main Grammar, Punctuation, and Writer Resources pages for more tips and resources.
References:
- O’Conner, P. T. (1996). Woe Is I, the Grammarphobe’s Guide to Better English in Plain English. New York, G. P. Putnam’s Sons.
- Oxford Dictionaries. (2013). “Who or Whom?” OxfordDictionaries.com.