Results 1 to 7 of 7
  1. #1
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68

    Excel Import field truncation problem (to Access Memo field)

    I'm using vba code to import an Excel worksheet (xlsx) to Access 2007. One of the Excel fields contains more than 255 characters, but only the first 255 characters are importing, even though the Access field is a Memo field. Any idea why, or how I can resolve?
    Do While xlc1.Value <> ""
    rst1.AddNew
    rst1.Fields("ProjNbr").Value = xlc1.Offset(0, 0).Value
    rst1.Fields("ProjName").Value = xlc1.Offset(0, 1).Value
    rst1.Fields("ProjDate").Value = xlc1.Offset(0, 3).Value
    rst1.Fields("ProjAmt").Value = xlc1.Offset(0, 4).Value
    rst1.Fields("Comments").Value = xlc1.Offset(0, 6).Value
    rst1.Update
    Set xlc1 = xlc1.Offset(1, 0)
    Loop

    Please don't question why I'm using vba code or suggest other methods of importing an Excel file. I have my reasons. Just wondering how I can import all the characters from the Excel field into the "Comments" Memo field.



    Thanks for your help.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    None of those situations applies to my problem. The Excel field with the >255 characters is in the first row of data. And the data is being imported to an existing table, with the receiving field type of Memo.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    It is the same in that VBA code is adding records to a recordset. The thread discussion indicates the issue is not easy to resolve and there is not a 'one fits all' answer. I don't even know if that poster ever solved it.

    The best idea that I could derive was to do import with the wizard then use that imported table as the data source for transfer of records to the final table. Of course, your spreadsheet structure might be too complex for the wizard, which is probably why you are using VBA to begin with.

    If you want to provide the Excel file, will see what I can do.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    There are 14 individuals creating 14 Excel files daily, all in the same format. I am building an Access db for the Admin Asst to use to import these files daily into an Access table. I want to use a form where she can just click a button to import each file automatically. Everything works fine, except that the code is truncating the fields that contains more than 255 characters, even thou the table fields are Memo type. You can use any Excel file for testing.
    Thanks

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I just did a test of VBA importing from Excel a string of 599 characters into recordset. No truncation. I cannot replicate your issue. Provide your file and complete code procedure and I will test.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    Problem solved, thou I'm not sure why. It appears that I actually am importing all the characters, but was only seeing the first 255 in the field because the Memo field was formatted as "@", which appears to be the default formatting. When I deleted the @, I can now see all of the characters. Now I need to determine how to change the default formatting. Many thanks for all your help, and sorry it appears that I was leading you down the wrong path.
    Thanks again,
    JR

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-19-2012, 10:46 AM
  2. memo field problem
    By gustavopalminha in forum Programming
    Replies: 4
    Last Post: 05-07-2012, 08:33 AM
  3. Field Truncation
    By Jesse_Munos in forum Queries
    Replies: 1
    Last Post: 04-20-2012, 03:09 AM
  4. Replies: 20
    Last Post: 09-06-2011, 12:39 PM
  5. Replies: 0
    Last Post: 03-15-2010, 01:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums