Why am I getting a compile error when i try to use the .find method (ADO, Recordset)?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ppletkov
    New Member
    • Dec 2009
    • 1

    Why am I getting a compile error when i try to use the .find method (ADO, Recordset)?

    Hi -
    I apologize if this is a simple question in advance :-) (hopefully it is so its quickly resolved!)

    i'm trying to figure out why i keep getting an error (Compile Error : expected function or variable) for my .find method. I have checked the format of this statement and it appears correct...?
    Code:
    Dim ItemNumberWLO As String
    Dim ItemNumberWLN As String
    
    While Not WLO.EOF
    
        If WLO.Fields.Item(1).Value <> "Null" Then 'skips the blank rows at the beginning
        ItemNumberWLO = WLO.Fields.Item(1).Value
    Set ItemNumberWLN = WLN.Find("ITEM NO = ItemNumberWLO")
        
          If Not ItemNumberWLN.EOF Or ItemNumberWLN.BOF Then
            Sheet1.Cells(RowCount, CurrentCell) = WLN.GetRows
            End If
        End If
    WLO.MoveNext
    
    Wend
    Can anyone explain to me why i'm getting this compile error?

    What i'm trying to do is look at an item number in one recordset, and then see if that number exists in another recordset, and if so, copy that entire row to an excel table.Thus far I have 2 open connections to two other excel files, pulling those recordsets to do this while loop.

    HELP!

    thanks,
    VB Novice
    Last edited by debasisdas; Dec 12 '09, 02:19 PM. Reason: Formatted using code tags.
Working...