Kotter and Kschischang presented in 2008 a new model for error correcting codes in network coding. The alphabet in this model is the subspace lattice of a given vector space, a code is a subset of this lattice and the used metric on this alphabet is the map d : (U, V) bar right arrow dim(U+V)-dim(U boolean AND V). In this paper we generalize this model to arbitrary modular lattices, i.e. we consider codes, which are subsets of modular lattices. The used metric in this general case is the map d : (u, v) bar right arrow h(u boolean OR v) - h(u boolean AND v), where h is the height function of the lattice. We apply this model to submodule lattices. Moreover, we show a method to compute the size of spheres in certain modular lattices and present a sphere packing bound, a sphere covering bound, and a Singleton bound for codes, which are subsets of modular lattices.