Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filling a ComboBox from a Recordset (A2K)

    Hi all,
    I'm working with an ADP and need to fill a ComboBox with data from another server.
    I think that a Recordset could solve my problem but I don't know how to fill the ComboBox using it!
    Here is my code:
    <code>
    Dim Conn As ADODB.Connection
    Set Conn = New ADODB.Connection
    Dim rs as New ADODB.RecordSet
    Dim strSQL as String


    Conn.Open "Driver={SQL Server};Server= svrName;Database= dbName;Trusted_Connection=yes;"

    strSQL = "SELECT fields FROM tblName"

    rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
    </code>

    I tried with <code>ComboBox.rowsorce = rs</code> and of course, it didn't work
    Then I thought that a property like <code>addItem</code> could solve the problem but I didn't find such a property for a combobox.

    Any advice will be very helpful
    Thanks in Advance.

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filling a ComboBox from a Recordset (A2K)

    Hi Queque,
    I asked something like that quite a while ago <post:=151,094>post 151,094</post:>. It wasn't for ADP, but maybe it will give you an idea or two
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  3. #3
    New Lounger
    Join Date
    Sep 2006
    Location
    Quilmes, Argentina
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filling a ComboBox from a Recordset (A2K)

    Hi Gary,
    Thanks for your help!
    I solved my problem creating a SQLserver view but I think that your solution may be helpful sometime in the future!

    Again, Thanks and Regards!

Posting Permissions

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