Hi there
I'm using Access 2007 to import data from Excel using VBA. I have this code:
Private Sub cmd1Importa_Click()
Dim myRec As DAO.Recordset
Dim strQry As String
Dim dbExcel As DAO.Database
Dim rsExcel As DAO.Recordset
Set myRec = CurrentDb.OpenRecordset("Tabela1")
Set dbExcel = OpenDatabase("C:\BasesTestes\Testes\TabelaParaImpo rtar.xlsx", False, True, "Excel 12.0; IMEX=1;")
Set rsExcel = dbExcel.OpenRecordset("Plan1$")
Do While Not rsExcel.EOF
myRec.AddNew
myRec.Fields("Coisa1") = rsExcel.Fields("Coisa1")
myRec.Fields("Coisa2") = rsExcel.Fields("Coisa2")
myRec.Fields("Coisa3") = rsExcel.Fields("Coisa3")
myRec.Update
rsExcel.MoveNext
Loop
End Sub
But the ODBC driver reads only the first 16 records and chose for the column 3 (Coisa3) data type String with 255 characters max. And in the worksheet that I have texts with over 255 characters that are not being imported. I can choose the data type of the third column as memo? How?
Thanks