GO top SCAN IF wScanForEndOfDay = 1 replace ScanGrL.OutForEOD WITH 0 endif wMessBody = wMessBody + CHR(13) + ALLTRIM(STR(ScanGrL.OrdNmb)) ENDSCAN wnAnswer = MESSAGEBOX(wMessBody, 4 + 32 + 256, goApp.cCaption)The GO TOP is stupid since the scan will start at the top. This is a case of knowing how FoxPro works. The wScanForEndOfDay is a memory variable. It will not change as the scan runs. So why execute it once per row - something SQL Server people call RBAR - row by agonizing row? Seems they don't like slow crap. While the code is going through all the rows it does a replace. One fake expert here claimed that mdot is not important, but without knowing wScanForEndOfDay is a memvar, it is included in the loop which is wasteful. Knowing it is a memvar - and where has this w prefix come from? It's not hungarian notation, so how can we tell? mdot makes it obvious to programmers and the compiler. Naming conventions only help those who share them. I don't behave like a Nazi and force people to use my preferred convention. I don't even force anyone to use mdot. I use it because it is bullet proof. I'm not interested in silly code cosmetics. As long as I can read and maintain it with clarity and the compiler can execute it with speed and safety, all the better. Conventions are of little benefit when the compiler does not use those conventions.
IF m.wScanForEndOfDay = 1 REPLACE OutForEOD WITH 0 for OutForEOD<>0 in ScanGrL endif SCAN wMessBody = m.wMessBody + CHR(13) + ALLTRIM(STR(OrdNmb)) ENDSCAN wnAnswer = MESSAGEBOX(m.wMessBody, 4 + 32 + 256, m.goApp.cCaption)The last point is why is an application object holding a caption? That is not even close to proper scope.