Results 1 to 3 of 3

Thread: Database Returns

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Arrow


    I have a textbox named txtsearch and a listbox named list1. When I use this code it only returns the first result and no more. But I really need it to return ALL recordsets where ReportNum = txtsearch. Any Ideas? Preferably by adding to this code.

    txtsearch.txt
    Set RS = DB.OpenRecordset("SELECT * FROM Main WHERE _ ReportNum = '" & txtsearch.txt & "'", dbOpenDynaset)
    List1.AddItem (RS!Place)
    RS.Close
    End Sub
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    this should do it..
    if you aren't moving you get only one, the first.
    Code:
    txtsearch.txt 
    
    Set RS = DB.OpenRecordset("SELECT * FROM Main WHERE _ ReportNum = '" & txtsearch.txt & "'", dbOpenDynaset) 
       rs.refresh
       rs.movefirst
    
     While not RS.eof
        List1.AddItem (RS!Place) 
        RS.movenext
     Wend
        RS.Close 
           Set RS = Nothing
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Thanks Joe

    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

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