I used following code developed by one of friends here to transfer data from Excel to Access. However, no matter how many data rows in my excel spreadsheet include, when the transfer is done. The first 28 rows in access are always empty. I am really confused about this. Anyone has similar experience or where is the problem from? Really appreciate your guidance.
Here is the code:
--------------------------------------------------------------------------------------
Sub DataTransfer()
'Transfer data from Excel to Access
Dim appAccess As Access.Application
Set appAccess = New Access.Application
ActiveWorkbook.Names.Add Name:="TransferRange", RefersToLocal:=Range("A1:T" & Range("A65536").End(xlUp).Row)
appAccess.OpenCurrentDatabase "C:\Documents and Settings\msand\Desktop\Monthly Report Database.mdb"
appAccess.DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel97, _
"tblmtlyReport", _
ActiveWorkbook.Path & "\" & ActiveWorkbook.Name, _
True, "TransferRange"
appAccess.CloseCurrentDatabase
appAccess.Quit
MsgBox "Transfer Complete", vbOKOnly, "Data Transfer"
End Sub
-------------------------------------------------------------------------------------
Here is the code:
--------------------------------------------------------------------------------------
Sub DataTransfer()
'Transfer data from Excel to Access
Dim appAccess As Access.Application
Set appAccess = New Access.Application
ActiveWorkbook.Names.Add Name:="TransferRange", RefersToLocal:=Range("A1:T" & Range("A65536").End(xlUp).Row)
appAccess.OpenCurrentDatabase "C:\Documents and Settings\msand\Desktop\Monthly Report Database.mdb"
appAccess.DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel97, _
"tblmtlyReport", _
ActiveWorkbook.Path & "\" & ActiveWorkbook.Name, _
True, "TransferRange"
appAccess.CloseCurrentDatabase
appAccess.Quit
MsgBox "Transfer Complete", vbOKOnly, "Data Transfer"
End Sub
-------------------------------------------------------------------------------------