The difference as followed.
1、你说的跟他说的是一码事。“一码事” mean something has some same characters, the thing and what you said thing are similar, but not a same thing. It expresses a same type things.
2、你说的跟他说的是一件事。“一件事” ="同一件事“ in this context. That mean a same thing. But some sometime it can be tanslated "a thing, one thing"
By the way, if you still can not understand well, I'd like to offer you the help you need.^_^