Results 1 to 2 of 2

Thread: end/if statement prob.

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    7
    hi everyone,
    im having a problem with a procedure in a program im working on.the code looks like this:

    Private Sub ShowDepSchedule(item As String, cost As Single, purchYear As Integer, numYears As Integer, depType As Single)

    Dim depreciation As Single, straightLineDep As Single
    Dim totalDeprec As Single, value As Single, yr As Integer

    picOutput.Cls
    picoutpur.Font = "courier new"
    Call ShowHeading(item, cost, purchYear, numYears, depType)
    Let value = cost
    If depType = 1 Then Let straightLineDep = (1 / numYears) * value
    Let totalDeprec = 0
    For yr = 1 To numYears
    If yr <> numYears Then
    If depType = 1 Then
    Let depreciation = straightLineDep
    Else
    Let depreciation = 2 / (numYears * value)
    Else
    Let depreciation = value
    End If
    Let totalDeprec = (totalDeprec + depreciation)
    Call ShowYr(purchYear + yr - 1, value, depreciation, totalDeprec)
    Let value = (value - depreciation)
    Next yr


    End Sub



    anyways, i keep getting an else without if error. if anyone can help i would really appreciate it.
    thanks, meth

  2. #2
    Guest
    Gudday Meth,

    Insert an "End If" statement after the lines

    Else
    Let depreciation = 2 / (numYears * value)

    and before the lines

    Else
    Let depreciation = value
    End If

    Thereby ending up with

    If yr <> numYears Then
    If depType = 1 Then
    Let depreciation = straightLineDep
    Else
    Let depreciation = 2 / (numYears * value)
    End If
    Else
    Let depreciation = value
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width