FUNCTION getphoto() PARAMETERS tnid IF file(alltrim(gcAppPath)+"\photo\" + alltrim(str(tnid))+".jpg") lcImagePathName = "\photo\" + alltrim(str(tnid))+".jpg" ELSE lcImagePathName = "\photo\nophoto.jpg") ELSE RETURN lcImagePathNameOne problem with using the primary key like I did, is that if the primary id changes you loose which photo belongs to which records. You have want to name the photo something more recognizable.