kindly find updated test.doc

Try this but i am not sure. b'cos i have not tried it myself. get back if any problem.

rscombo.Open "select MAX(MID(item_code,2,10)), ITEM_CODE from production WHERE item_code is not NULL  and  LEFT(ucase(trim(Production.ITEM_CODE)),1) = 'P' GROUP BY ITEM_CODE "

kindly find the ahmed attachment.

rscombo.Open "select max(VAL(MID(item_code,2,10))), item_code  from production  WHERE item_code is not NULL  and  LEFT(ucase(trim(Production.ITEM_CODE)),1) = 'P' GROUP BY ITEM_CODE ORDER BY VAL(MID(item_code,2,10)) DESC"

If the problem is solved please mark the thread as solved.

Thank you SIR,

I WILL REMAIN GRATEFUL TO YOU

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.