Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2984
  • Last Modified:

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
0
arajoe
Asked:
arajoe
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now