Line 111 will return an error if there are no records or if it's not in browse mode, so trap for it using:
Go To Layout [ refurb_etc... ]
Enter Browse Mode
Show All Records
If [ Get(FoundCount) > 0 ]
Delete All Records
Go To Layout [ Original Layout ]
new steps in bold.
In addition to Mikes suggestion you should:
1. trap for zero records found set after lines 120 and 125
Set error capture (on)
Set error capture off
If ( get ( foundCount ) > 0 )
2. remove the go to layout at line 112 unless their are some valuable layout level script triggers that need to fire on the Original layout before the script proceeds to line 113.
Thanks that's solved that!
Also line 115 - 116. In one of our quotes Do At Assessment is set to "No"
But It is going down the path for Do At Assessment = "Yes"? Why is this?
Your IF statement on 116 is evaluating from the REFURB table but you are on the ASSESSMENTS layout, so chances are it's evaluating data in a way you are not expecting.
I've removed the go to layout don't know why it is there haha
Because after you go to layout line 115 your in a found set of ASSESSMENTS records on the first record in the set.
The script then checks that one record in the if statement conditional.
Are you expecting it to loop thru the records?
PS good catch Mike
If I moved Go to Layout [Assessments] into the IF would this be the correct way?
The found set is bringing up the wrong perform find in some cases.