local llok, lcerrormessage llok = .t. lcerrormessage = "" local lcmdb if m.llok lcmdb = getfile('mdb') llok = file(m.lcmdb,1) lcerrormessage = "" endif local lcconnectionstring, h if m.llok lcconnectionstring = ; "DRIVER=Microsoft Access Driver (*.mdb);" + ; "DBQ=" + justfname(m.lcmdb) + ";" + ; "DefaultDir=" + justpath(m.lcmdb) + ";" + ; "DriverId=25;FIL=MSAccess;MaxBufferSize=2048;PageTimeout=5" h = sqlstringconnect(m.lcconnectionstring) llok = ( h > 0 ) if !m.llok lcerrormessage = getlasterror() endif endif local n local lctable,lctable2 if m.llok lctable = 'data' && whatever your specs say lctable2='pictures' n = sqlexec(h,[Select * From ] + m.lctable,m.lctable2+ [ WHERE INT(VAL(lcTable.imageid))=lcTable2.ID; AND lcTable.Nomber LIKE '%99%'],'temp') llok = ( n > 0 ) if !m.llok lcerrormessage = getlasterror() endif endif if m.llok browse endif try sqldisconnect(h) catch endtry if !m.llok and !empty(m.lcerrormessage) messagebox(m.lcerrormessage,48) endif return function getlasterror() local lcmessage, laerror[1] lcmessage = "" aerror(laerror) if type('laError[2]') = 'C' lcmessage = laerror[2] endif return m.lcmessage endfunctHANKS