Let nq(k, d) denote the smallest value ofn for which there exists a linear In, k, d]-code over GF(q). An In, k, d]-code whose length is equal to nq(k, d) is called optimal. The problem of finding nq(k, d) has received much attention for the case q = 2. We generalize several results to the case of an arbitrary prime power q as well as introducing new results and a detailed methodology to enable the problem to be tackled over any finite fidd.In particular, we study the problem with q = 3 and determine n3(k, d) for all d when k -< 4, and n3(5, d) for all but 30 values of d.