Results 1 to 11 of 11

Thread: populate combobox from SQL db

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    5

    populate combobox from SQL db

    Hello, I have been working at this for days and am no better off. I could really use some help.
    I need to populate a combobox with data from a column in an SQL table. I have put together the code below but am having an error at this line:

    invBegNum.additem rs.Fields.Item("RMDNUMWK").Value

    Error message:

    "Object doesn't support this property or method"

    I'm really a newb but am trying hard to get this. Here is the code. Please help.
    VB Code:
    1. Sub getInvData()
    2. Dim conn As ADODB.Connection
    3. Dim connString As String
    4.  
    5. conString = "Provider=sqloledb;Data Source=localhost;Initial Catalog=BBTN;User Id=scott;Password=bigdaddy"
    6.  
    7. Set conn = New ADODB.Connection
    8. conn.ConnectionString = conString
    9. conn.Open connString
    10.  
    11. Dim rs As ADODB.RecordSet
    12. Dim sSQL As String
    13.  
    14. Set rs = New ADODB.RecordSet
    15. sSQL = "select RMDNUMWK from SV00564 order by RMDNUMWK"
    16. rs.Open sSQL, conn
    17.  
    18. Do Until rs.EOF
    19. invBegNum.additem rs.Fields.Item("RMDNUMWK").Value
    20. rs.MoveNext
    21. Loop
    22. rs.Close
    23. conn.Close
    24. Set conn = Nothing
    25. Set rs = Nothing
    26.        
    27. End Sub









    Added vbcode tags - Hack
    Last edited by Hack; Jan 11th, 2006 at 08:34 AM.

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