I am trying to get some validations against another table to validate some user inputs. If the data validates good then it should continue. If the data doe not validate correctly I need to be able for the user to re-enter the data and have the validation run again. I have the validation working decent if the input is correct, but if it is incorrect I am having trouble getting the form to keep the focus on the mix_tank field so that the user can re-enter the correct data and running the validation again. Here is what I have for the x-basic code, any help or input would be greatly appreciated.
Code:
t = table.current() vCurrentFlavor = alltrim(t.flavor) ' Look up last flavor for this mix tank from lastank.dbf populate lastmix and last system fields ' in batchead.dbf tLast = table.open("LasTank") query.order = "" query.filter = "Mix_Tank = '" + alltrim(t.Mix_Tank) + "'" qdx = tLast.query_create() if qdx.records_get() > 0 vLastFlavor = alltrim(tLast.FLAVOR) end if 'update the last tank field in the batchead database t.Lastmix = vLastFlavor tLast.close() ' Use SluryChk.dbf to insure the current flavor can follow the previous flavor tS = table.open("slurychk") query.order = "" query.filter = "Item = '" + vCurrentFlavor + "' .and. ItemBefore = '" + vLastFlavor + "'" qdx = tS.query_create() if qdx.records_get() = 0 msgbox("Incompatibility", vCurrentFlavor + " cannot be this tank because the Last flavor was " + vLastFlavor + ".") MIX_TANK.value = " " MIX_TANK.activate() else msgbox("This is OK to proceed.") end if tS.close() '' Update the lastank.dbf with the current flavor, date, and ticket number for use on the next surry mixture tUpdate = table.open("lastank") query.order = "" query.filter = "Mix_Tank = '" + alltrim(t.Mix_Tank) + "'" qdx = tUpdate.query_create() if qdx.records_get() = 1 tUpdate.change_begin() tUpdate.Flavor = vCurrentFlavor tUpdate.Date = date() tUpdate.Ticket = t.Ticket tUpdate.change_end(.t.) else msgbox("Unable to update Lastank - see your local experts.") end if tUpdate.close()
Comment