Hi
I am trying to import an Excel sheet to access table and i find the comments section being truncated.I changed the data type in table to long text ( Rich text) .but it truncates less than 255 char.
My DATA table has two fileds with longtext( Rich Text) datatype. can you tell me which part of my codes is wrong ?
how can keep my long text as is .
I am trying to import an Excel sheet to access table and i find the comments section being truncated.I changed the data type in table to long text ( Rich text) .but it truncates less than 255 char.
My DATA table has two fileds with longtext( Rich Text) datatype. can you tell me which part of my codes is wrong ?
how can keep my long text as is .
Code:
Public Function Import()
DoCmd.SetWarnings False
Dim td As TableDef
Dim db As DAO.Database
Dim Name As String
'FileDialog
Set f = Application.FileDialog(3) 'msoFileDialogFilePicker
With f
.InitialFileName = Application.CurrentProject.Path & "\"
.Show
Dim varFile As Variant
For Each varFile In .SelectedItems
Name = varFile
FileName = Dir(varFile)
Workbooks.Open(varFile).Sheets("Report Details").Activate
Dim i As Integer
i = Cells(Rows.Count, 1).End(xlUp).Row
ActiveWorkbook.Close False
i = i - 1
DoCmd.RunSQL ("INSERT INTO ImportedRows (Rows) VALUES ('" & i & "');")
Debug.Print i
Dim oFSO As Object
//create a copy of the excel file
Set oFSO = CreateObject("Scripting.FileSystemObject")
Call oFSO.CopyFile(Name, Application.CurrentProject.Path & "\NewExcel\", True)
FSO_FileCopy = True
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "DATA", varFile, True, "Report Details!"
Next
End With
Exit Function
Error_:
If (Err.Number = 50290) Then Resume
Resume
End Function
Last edited by a moderator: