I don't know why I get a type mismatch( cmbcountry.AddItem rs.Fields(0) )

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jondulz
    New Member
    • Feb 2014
    • 1

    #1

    I don't know why I get a type mismatch( cmbcountry.AddItem rs.Fields(0) )

    Code:
    Private Sub Button1_Click()
    strSQL = "Select Distinct [Country] From [Data$] Order by [Country]"
        closeRS
        OpenDB
        cmbcountry.Clear
        
        rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
        If rs.RecordCount > 0 Then
            Do While Not rs.EOF
                cmbcountry.AddItem rs.Fields(0)
                rs.MoveNext
            Loop
        Else
            MsgBox "I was not able to find any unique Country.", vbCritical + vbOKOnly
            Exit Sub
        End If
    I'm doing a database using VB-SQL thru MS excel... I dont know why I always get a type mismatch...
    Last edited by Rabbit; Feb 20 '14, 04:06 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...