Hi

I have a problem when running the attached code extract in that instead of overwriting the query results the results are appended. What's the best way around this?

Thanks



Private Sub CommandButton2_Click()
    
    Dim q As QueryTable
    Dim sConn As String
    Dim cdtext As String

    sConn = "ODBC; DSN=Warehouse-mysql;"
    

    cdtext = "Select * from Customers"

    Set q = Sheet2.QueryTables.Add(sConn, Sheet2.Range("A1"), cdtext)
    q.Refresh
        
End Sub