I'm new to using the field calculator, and also new to writing code. I'm trying to use VB Script in the calculator to essentially merge the information in four separate fields into one large field. I started out just by adding them all together in order separated by spaces. This worked however many of the rows are blank which is creating field values of numerous spaces, so I want to try to incorporate an if then statement for each field that will be merged so that if a field is blank for one record it won't be transferred into the new field. I've found and used coding examples in the archived forums and copy/pasted them with the values I though should work but nothing seems to be working. I keep getting syntax errors. Also is it even possible to have four to five if then statements in one field calculator statement? Please help relieve my frustration.
Thanks for replying so quickly I'll post one of the scripts that I've tried, and a quick follow up question before hand, when using the Pre-Logic Script Code block, why do you still need to add a statement into the normal block? Shouldn't it just use the code that is written to determine the field value?
My attempted code:
Dim result as String If [PROJECT_CO] = 0 Then result = 0 Else result = [PROJECT_CO] End if