Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

'If' scripting not working properly

$
0
0
I realize that there are some other problems with the attached scripting but I am having trouble with the ‘If’ statement. Please focus your attention on lines 4 through 15. I want to compare the names on two different folders using two ‘For Each’ commands – these two ‘For Each’ statements cycle through the names just like I need. When a match is found AND when another field has a value of 1, I want to do something (actually, I want to remove that particular record from the recordset). The problem is that the ‘If’ statement does not recognize this as a match when both names match and the other field is a ‘1’ – the program currently identifies a match as whenever the name on the inner ‘For Next’ statement has a value of ‘1’ regardless of the name on the outer 'For Each'. See screenshot below because this is where the program first stopped at (clearly, the '$name_from_completed' value is not the same as '$name_from_all_employees' though this was the first occurrence where the program encountered the '$inactive_status' of '1'). Why is the scripting interpreting the value in '$name_from_completed' (Greene Daryl R) to be the same as the value in '$name_from_all_employees' (Johnson Greene Lynn)?

Later, once this issue is corrected, I have to also correct the value in '$original_completed' as I wanted to have a temporary storage location for the original value... but before I go there, I need to understand why the 'If' statement is not operating properly. Any help will be greatly appreciated.

There is possibly a much better and efficient way to accomplish this - if you have any ideas, please share them!

[edit] I went back and took out the second rule in the 'If' statement (And [$inactive_status] =1) and just like I assumed, the program identified a match to be between any two names regardless of whether an actual match existed. Why is the program seeing a match between all names when a true match does not always exist?[/edit]
Thanks,
Daryl G

Attached Images
File Type: jpg if command problem.jpg (245.5 KB)

Viewing all articles
Browse latest Browse all 13329

Trending Articles