Results 1 to 11 of 11

Thread: ***RESOLVED***Populating a ListBox (SIMPLE)

Threaded View

  1. #1

    Thread Starter
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396

    ***RESOLVED***Populating a ListBox (SIMPLE)

    I'm using the following code to Populate a ListBox, but when I call this function List on a Command Button's click event, it does not populate the ListBox & during run time I checked the value of Recordcount it shows -1. I have a Access Database which has 4 tables that I'm trying to access...Any suggestions!!!

    VB Code:
    1. Priavte Function List()
    2. Dim Max As Long
    3. conDB
    4. Set oRs = New ADODB.Recordset
    5. oRs.Open "PDetails", goCnn, dOpenKeyset, adLockOptimistic
    6. Max = oRs.RecordCount
    7. oRs.Move BOF
    8. List1.Clear
    9.  
    10. For I = 1 To Max
    11. List1.AddItem oRs!Name & "," & oRs("E-Mail")
    12.     oRs.MoveNext
    13. Next I
    14. End Funtion

    VB Code:
    1. Public Function conDB()
    2.     Set goCnn = New ADODB.Connection
    3.     goCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB5.mdb;"
    4.     goCnn.Open
    5. End Function
    Last edited by mxnmx; Nov 5th, 2002 at 01:04 PM.
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

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