******************************************************************** * Description.......: cmdReplace.Click * Calling Samples...: * Parameter List....: * Created by........: * Modified by.......: Nadya Nosonovsky 08/20/2002 01:29:02 PM ******************************************************************** local lcOldStreetName, lcNewStreetName, lcCond, ; lnRecno, lcNewCode, lcNewTown, lnSelect, ; lnOldStNum, lcOldStNumExt, lnNewStNum, lcNewStNumExt, llReplaceStNum, lnCount set exact off lnSelect = select() && Save current area select BldMstr lnRecno=recno('BldMstr') lnCount = 0 with thisform lcNewStreetName=trim(.txtNewStreetName.value) lcOldStreetName=trim(.txtOldStreetName.value) llReplaceStNum = not empty(.txtNewStNum.value) and not empty(.txtOldStNum.value) if m.llReplaceStNum lnOldStNum = val(trim(.txtOldStNum.value)) lcOldStNumExt = trim(.txtOldStNumExt.value) lnNewStNum = val(trim(.txtNewStNum.value)) lcNewStNumExt = trim(.txtNewStNumExt.value) lcCond = upper(.cOldCcode + .cOldTown + ; padr(m.lcOldStreetName,25) + ; padl(trim(.txtOldStNum.value),4)+ trim(.txtOldStNumExt.value)) else lcCond=upper(.cOldCcode + .cOldTown + m.lcOldStreetName) endif lcNewCode=.txtState.value lcNewTown=.txtCity.value if not (m.lcNewStreetName==m.lcOldStreetName) or not ; (m.lcNewCode==.cOldCcode and m.lcNewTown==.cOldTown) or not ; (m.lnOldStNum==m.lnNewStNum and m.lcOldStNumExt == m.lcNewStNumExt) if .Mode='Situs' wait window nowait 'Wait while updating Situs info...' scan for upper(ccode+town+Street+str(StNum,4)+StNumExt+Unit)= m.lcCond if m.llReplaceStNum replace Street with m.lcNewStreetName, ccode with m.lcNewCode, ; town with m.lcNewTown, ; StNum with m.lnNewStNum, ; StNumExt with m.lcNewStNumExt, ; ModiType with 'C', ; (.cWorkField) with .cReplVal else replace Street with m.lcNewStreetName, ccode with m.lcNewCode, ; town with m.lcNewTown, ModiType with 'C', ; (.cWorkField) with .cReplVal endif lnCount = m.lnCount+1 endscan else wait window nowait 'Wait while updating Owner Street...' scan for upper(OwnerState+OwnerCity+OwnerStrt+str(OwnerStNum,4)+ ; OwnerStExt+OwnerUnit) = m.lcCond && Updated:NN: 08/20/02 if m.llReplaceStNum replace OwnerStrt with m.lcNewStreetName, ; OwnerStNum with m.lnNewStNum, ; OwnerStExt with m.lcNewStNumExt, ; ModiType with 'C', ; (.cWorkField) with .cReplVal else replace OwnerStrt with m.lcNewStreetName, ModiType with 'C', ; (.cWorkField) with .cReplVal endif lnCount = m.lnCount+1 endscan endif go m.lnRecno in BldMstr wait clear wait window nowait transform(m.lnCount)+ " replacements were made..." endif .FormClose() endwith select (m.lnSelect) && Go Back to original areaHere is the strange thing: if I invoke my Global Editor before doing some replacements in Extension field, everything works fine and I have 26 replacements when I change one Street Name to another Street Name. However, I have a button on the form, which allows me to change Street Extensions. Suppose, I press this button, change all extensions from blank to something, then execute my Global Replace. It doesn't work now and only one replacement for the current record was made. If I run it in Debugger, it seems to work fine again. I don't understand it. My condition is the same, part of the string still should satisfy the condition, I have SET EXACT OFF.