amie1304

if-else statement with vba

Discussion created by amie1304 on Jun 15, 2011
Latest reply on Jun 17, 2011 by syamarth
Hi,
Below is a part of my code that has no error when running but all of the values of Type field are Hospital. Where is the mistake? Thanks for giving correction.

Do Until pFeature Is Nothing
    If pFeature.Value(intFacilitiesValue) Like "SD%" Then
        pFeature.Value(intTypeValue) = "School"
    ElseIf pFeature.Value(intFacilitiesValue) Like "SMP%" Then
        pFeature.Value(intTypeValue) = "School"
    ElseIf pFeature.Value(intFacilitiesValue) Like "Bank%" Then
        pFeature.Value(intTypeValue) = "Bank"
    ElseIf pFeature.Value(intFacilitiesValue) Like "BRI%" Then
        pFeature.Value(intTypeValue) = "Bank"
    ....
    ....
    ....
    Else
        pFeature.Value(intTypeValue) = "Hospital"
    End If

    pFCursor.UpdateFeature pFeature
    Set pFeature = pFCursor.NextFeature
Loop

Outcomes