you can do an isnumeric check to verify the value is numeric then change it to a number (forcing it to be if MS Access is reading it as a string) with the CINT or CDBL.
If you are defining iSort = "99" you are defining it as a string in your code
Dim iSort
iSort = 99
the " marks will cause mayhem.
You can also do
Code:
debug.print "SELECT tblStock.SortNo, tblStock.PONumber, tblStock.LiftType, tblStock.LiftNo, tblStock.StartQty, tblStock.AllocatedQty, tblStock.NewQty FROM tblStock WHERE SortNo < " & iSort & " ORDER BY SortNo;"
to see how your SQL string looks before you try to execute it. I'll bet it's throwing ' or " marks around your isort value or your isort isn't what you think it is