AnsweredAssumed Answered

VB Error 6 on line 0 expected statement

Question asked by granthay on Jun 7, 2017
Latest reply on Jun 7, 2017 by granthay

Hi everyone, I've been tasked with labeling some soil borings with the corresponding analytical data. I wrote out a VB script with multiple if then statements to concatenate strings with the analytical values and replace any 0s in the data with a "ND" or non detect. Whenever I try to run the script I get "error 6 on line 0 expected statement" or "error 5 on line 0 expected statement"  I've checked all the if/then statements, and I've even tried pairing it down to just one statement to try to troubleshoot the rest, I can't seem to find anything wrong, I'm hoping someone here can help me out.

 

Function FindLabel( [Shallow_GRO], [Shallow_DRO], [Shallow_ORO], [Shallow_PNA], [Deep_GRO], [Deep_DRO], [Deep_ORO], [Deep_PNAs])
if ([Shallow_GRO]>0)then
FindLabel = FindLabel &vbnewline& "GRO" & [Shallow_GRO]
elseif ([Shallow_GRO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Shallow_DRO] > 0)then
FindLabel = FindLabel&vbnewline& "DRO" & [Shallow_DRO]
elseif ([Shallow_DRO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Shallow_ORO]>0)then
FindLabel = FindLabel&vbnewline& "ORO" & [Shallow_ORO]
elseif ([Shallow_ORO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Shallow_PNA]>0)then
FindLabel = FindLabel&vbnewline& "PNA" & [Shallow_PNA]
elseif ([Shallow_PNA]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Deep_GRO]>0)then
FindLabel = FindLabel&vbnewline& "GRO" & [Deep_GRO]
elseif ([Deep_GRO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Deep_DRO]>0)then
FindLabel = FindLabel&vbnewline& "DRO" & [Deep_DRO]
elseif ([Deep_DRO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Deep_ORO]>0)then
FindLabel = FindLabel&vbnewline& "ORO" & [Deep_ORO]
elseif ([Deep_ORO]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
if ([Deep_PNAs]>0)then
FindLabel = FindLabel&vbnewline& "PNA" & [Deep_PNAs]
elseif ([Deep_PNAs]=0) then
FindLabel = FindLabel &vbnewline& "ND"
endif
End Function

Outcomes