Stumped by a Syntax Error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: U-CDK_CHARLES\\Charles (_at_aol.com)
Date: 11/22/04


Date: Mon, 22 Nov 2004 20:25:32 GMT

I've two similar snippets of code, one of which compiles, and one which
does not.

On the second snippet, when the set method is entered, it fails to
compile because of a "missing list separator"

The compiling and non compiling code are similar, as are the methods. I
cannot think of a reason why one would compile and the other not.

Does anyone know what I've botched in my set line method?

Thanks

Charles

The first snippet works correctly:

Private Sub importApprovals(importReq As CRequisition)

    Dim selectionRow As New CSubsetRow
    selectionRow.addColumn "Owner", importReq.ReqId
    
    Dim reqLineList As CList
    Set reqLineList = DataAccessor.read("Export_Approvals", _
        , selectionRow)
        
    Dim iter As IIterator
    Set iter = reqLineList.iterator
    
    Dim currRow As CRow
    Dim ItemNumber As Integer
    
    Dim currApproval As CApproval
    
    Do Until iter.IsDone
    
        Set currRow = iter.CurrentItem
        ItemNumber = currRow.getColumnValue("Ordinal")
            
        Set currApproval = importReq.Approval(ItemNumber)
        currApproval.setFromRow currRow
        Set importReq.Approval(ItemNumber) = currApproval
        
        Set currRow = Nothing
        iter.NextItem
    Loop
    
    Set iter = Nothing
    Set reqLineList = Nothing

End Sub

the second snippet does not compile:

Private Sub importReqLines(importReq As CRequisition)

    Dim selectionRow As New CSubsetRow
    selectionRow.addColumn "Owner", importReq.ReqId
    
    Dim reqLineList As CList
    Set reqLineList = DataAccessor.read("Export_ReqLines", _
        , selectionRow)
        
    Dim iter As IIterator
    Set iter = reqLineList.iterator
    
    Dim currRow As CRow
    Dim ItemNumber As Integer
    
    Dim currReqLine As CRequisitionLine
    
    Do Until iter.IsDone
    
        Set currRow = iter.CurrentItem
        ItemNumber = currRow.getColumnValue("[Item Number]")
            
        Set currReqLine = importReq.line(ItemNumber)
        currReqLine.setFromRow currRow

        Set importReq.line(ItemNumber) = currReqLine
        ' This line gets "Expected: List separator" at
        ' the parenthesis following "ItemNumber"

        
        Set currReqLine = Nothing
        Set currRow = Nothing
        iter.NextItem
    Loop
    
    Set iter = Nothing
    Set reqLineList = Nothing

End Sub

The methods being invoked:

Public Property Get Approval(idx As Integer) As CApproval

    If idx > maxApprovals - 1 Then
        Err.Raise vbObjectError + 5
    End If

    Set Approval = mApprovals(idx)

End Property

Public Property Set Approval(idx As Integer, vlu As CApproval)

    Dim i As Integer
    
    If idx >= maxApprovals Then
        Err.Raise vbObjectError + 5
    End If
    
    Set mApprovals(idx) = vlu
    
    ' (some stuff snipped that doesn't matter)
    
    mLastUpdate = Now
    mLastUpdatedBy = currentUser.UserLogin
    mSent = False
    
End Property

Public Property Set line(idx As Integer, vlu As CRequisitionLine)
                
    If idx < 0 Or idx > mNumLines Then
        Err.Raise vbObjectError + 9
    End If
    
    Set mLines(idx) = Nothing
    Set mLines(idx) = vlu
    
    Me.Status = REQ_STATUS_OPEN_CHANGED
    mSent = False
               
End Property

Public Property Get line(idx As Integer) As CRequisitionLine

    If idx < 0 Or idx > mNumLines Then
        Err.Raise vbObjectError + 9
    End If
    
    Set line = mLines(idx)

End Property



Relevant Pages

  • Re: Search engine in a form.....searching the captions
    ... Set the caption of the label to something like "Enter ... Dim mstrFormToSearch As String ... Private Sub Form_Open ... Click menu items Debug -> Compile. ...
    (microsoft.public.access.devtoolkits)
  • Re: Cryptic compile error
    ... Function auditlog() As String ... Dim lngLen As Long, lngX As Long ... MsgBox strMsg, vbOKOnly, "Access Error" ... Leaving out the "Call" keyword also gives a compile error. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Add name to combo box
    ... Editor) open, click on Debug> Compile ProjectName, where ProjectName is the ... (NewData As String, Response As Integer) ... Dim db As DAO.Database ...
    (microsoft.public.access.modulesdaovba)
  • VBCodeProvider
    ... When I compile the following code, it works fine only one time. ... Dim oCodeProvider As VBCodeProvider = New VBCodeProvider ... Dim oRetObj As Object = Nothing ... sb.Append("Imports System.Xml" & vbCrLf) ...
    (microsoft.public.dotnet.languages.vb)
  • VBCodeProvider
    ... When I compile the following code, it works fine only one time. ... Dim oCodeProvider As VBCodeProvider = New VBCodeProvider ... Dim oRetObj As Object = Nothing ... sb.Append("Imports System.Xml" & vbCrLf) ...
    (microsoft.public.dotnet.languages.vb)