Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    1

    Unanswered: method or data member not found

    I using vb 6.0 and microsoft sql server studio express.
    What i wanna do is populate data field name ItemType from database name AMS with table name ItemType into visual basic 6.0 combo box. The problem i facing is "method or data member not found" which point to .addItem.

    Is it i using wrong way to call ComboItemType or i done something wrong on my connection.
    Anybody know how to solve this problem, please help me.

    Thanks.


    Code:
    Private Sub Form_Load()
    
    Set conn = New ADODB.connection
    conn.Provider = "sqloledb"
    conn.Properties("Data Source").Value = "IT\SQLEXPRESS"
    conn.Properties("User Id").Value = "sa"
    conn.Properties("Password").Value = "123"
    conn.Properties("Initial Catalog").Value = "AMS"
    conn.Properties("Integrated Security").Value = "SSPI"
    
    conn.Open
    
    Dim sql As String
    sql = "Select ItemType from ItemType"
    Set rs = conn.Execute(sql, , adCmdText)
    
    With ComboItemType
    
    Do Until rs.EOF
    .AddItem rs.Fields("ItemType").Value
    
    rs.MoveNext
    Loop
    End With
    
    rs.Close
    conn.Close
    Set rs = Nothing
    
    End Sub

    edit by loquin: added [code]...[/code] tags for readability... Try it - you'll like it.
    Last edited by loquin; 12-02-09 at 19:42. Reason: added [code]...[/code] tags for readability... Try it - you'll like it.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What is ComboItemType? A control? Can you access any of this objects properties?

    Moving to Visual Basic topic as I do not feel that this has anything to do with the SQL side of things
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Add a breakpoint and figure out if it's the .AddItem method that's creating the problem, or if it can't find ItemType in the rs.Fields() collection.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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