Open RecordSet...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anbusds
    New Member
    • Mar 2015
    • 17

    #1

    Open RecordSet...

    Hi All,
    May i know How to open a RecordSet For the combobox?
    My Original Code as follows

    Code:
    Dim conn As New ADODB.Connection
    Dim objMyRecordset As New ADODB.Recordset
    
    Dim strSQL As String
    
    Set conn = New ADODB.Connection
    conn.ConnectionString = "Provider = SQLOLEDB; Data Source=SDSACCOUNT; Initial Catalog= SSPLCO; user ID=sa; Password=sa;"
    conn.Open
    'Do your query
    
    strSQL = "Select ITEMNO FROM ICITEM;"
    
    Set objMyRecordset.ActiveConnection = conn
    objMyRecordset.Open strSQL
    Me.Combo4.RowSourceType = "Table/Query"

    After i use this code nothing comeout on my combobox...

    Thanks in advance!!!
    Last edited by Rabbit; Apr 9 '15, 01:54 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data. Second Warning.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    I don't see where you actually set the rowsource for the combobox

    Comment

    • Anbusds
      New Member
      • Mar 2015
      • 17

      #3
      Can You Give me Correct Code that matching with the above?
      Any sample...

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Line 11 in your posted code.
        Set that variable as your recordsource for the combobox after line 15

        You might be interested in reviewing the cascading combo/filter article(s) as they cover this and much more.

        Don't worry if you don't follow all of the coding in the articles, just start a new thread with any questions and link back to the article in question.

        I'll just post the grouping I have on filtering... but the combobox articles are better match to topic.
        -filtering-

        Comment

        Working...