OpenFile "Requisition List"
SafeSelect «RequisitionID» = LReqNumber
If Info("Empty")
Message "The RequisitionID was not found"
Else
Message "Updating Req Sheet with PO Number"
«Status» = LPONumber
EndIf
Sometimes after the Select or SafeSelect command, I do see the correct record has been selected, I do get the message “Updating Req Sheet with PO Number” but then that single record that is selected (1 visible) is replaced with a different record and the different, undesired record gets the LOPNumber value while the record that was being looked at with my eyeballs has been deleted!
When I then recreate the deleted record, I attempt the procedure again and it all works as it should.
I’m not sure what to do with a report like this. Seems very unlikely.
If you wanted, you could put an extra check before the assignment, like this.
if «RequisitionID» = LReqNumber
«Status» = LPONumber
else
message "This should never happen! «RequisitionID» is "+«RequisitionID»+" should be "+LReqNumber
endif
If this actually is happening, maybe this would help give a clue as to why.
Also, you are assuming that to select operation will never return more than 1 record. I can see why that assumption is being made, but it would be more defensive to actually check.
The windows of each of the databases are in full view to see that the correct record has been found. I have a Message prior to the assignment so that I can see the correct record has been found. Adding to the confoundment is that the record count does not change and the desired record is not longer part of the dataset. If I do a search for it, it can not be found. I recreate it, run the procedure again and it works fine. All the while the record count remains the same. I’ve created a movie of it that I will share.