Results 1 to 2 of 2
  1. #1
    alexandre
    Guest

    put query results into combobox (VBA/WORD2000/SR1)

    I have finally gotten a SQL database connection and query right.
    Now I need to get the query results to populate a ComboBox on a form.
    How do I do that?

  2. #2
    New Lounger
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: put query results into combobox (VBA/WORD2000/SR1)

    Assuming that you are using ADO, this should do it for ya.

    Replace "FieldName" with the actual name of your field; rs with the name of your recordset and cbo with the name of your ComboBox.

    rs.MoveFirst
    Do Until rs.BOF Or rs.EOF
    cbo.AddItem rs("FieldName").Value
    rs.MoveNext
    Loop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •