VB6 Compile Error: Expected: =

I have this sub in my form

Private Sub Calc_Sup_Event_Rating(vEventID, vSupLname, vSUPFname As String)

    lblEventRating.Caption = "Event Rating: 0"
   
    Dim Sup_Evnt_Perf_

    If Len(vEventID) <> 0 And Len(vSupLname) <> 0 And Len(vSUPFname) <> 0 Then
   
        Dim Sup_Perf_ As Double
       
        Sup_Perf_ = 0
       
        Dim Sup_Event_Rating_ As ADODB.Recordset
               
        Set Sup_Event_Rating_ = Get_Sup_Event_Rating(vEventID, vSupLname, vSUPFname)
       
        With Sup_Event_Rating_
       
            If .RecordCount > 0 Then
       
                .MoveFirst
               
                Dim i As Integer
               
                For i = 0 To (.RecordCount - 1)
                           
                    Sup_Perf_ = Sup_Perf_ + !Avg
               
                    .MoveNext
                   
                    Next
           
            End If
           
        End With
       
        lblEventRating.Caption = "Event Rating: " & Sup_Perf_
       
    End If

End Sub

when I try to call it from another sub within the same form I get Compile Error: Expected: = . I get this before I even run it while just typing the code. I am calling it like this
 Calc_Sup_Event_Rating(EventID,LName,FName)
Thanks in advance
arajoeAsked:
Who is Participating?
 
hongjunCommented:
Try this

Call Calc_Sup_Event_Rating(EventID,LName,FName)
0
 
leclairmCommented:
Try:

 Calc_Sup_Event_Rating EventID,LName,FName

Don't use the brackets.
0
 
leclairmCommented:
Or do as hongjun suggests.
0
 
bruintjeCommented:
Hi arajoe,

If no statement is highlighted then the error could be in your code in the immediate window

hope this helps a bit
bruintje
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>Private Sub Calc_Sup_Event_Rating(vEventID, vSupLname, vSUPFname As String)
fyi in VB6, if yo don't specify what you Dim (i.e. Dim int as Integer), then it becomes a Variant, which could have a NULL value, which could cause an error.

>Set Sup_Event_Rating_ = Get_Sup_Event_Rating(vEventID, vSupLname, vSUPFname)
Also, since this is a recursive sub, your third variable vSUPFname is undefined here, which is interpreted as a Variant, but in your sub declaration it's a String.

Hope this helps.
-Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.