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

    VBA Import Error on Invalid Characters


    I run a job daily on the mainframe which creates an extract file containing over 4 million records which I import into an Access db. I created VBA code so that I can easily do the import everyday (the code formats a couple of fields during the import). Problem is I'm running into records that I believe have invalid ascii characters, and it's causing the process to stop importing when the first such record is encountered. I'm not even getting an error message. I didn't even know I had a problem until someone notified me that the table was missing records. My question is, how can I resolve this problem? The invalid characters are always in the same field. All other fields are okay. Why does access stop importing records when the field has an invalid character? Is there someway to test the field first and replace the invalid character with a space or something? I wouldn't even mind if the entire contents of the field were ignored, as long as the rest of the record is imported, along with the remaining records in the file. Due to the nature of the problem, I'm attaching a zip file which contains the db and 8 sample records from a file to be imported. The invalid characters are in the last field of the last 2 records. The last field begins in column 78.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is an escape, <ESC>, &01b, causing the problem and I'm looking into it. Just thought you'd like to know.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Turns out it was actually a <SUB> character which is the same character the OS uses to denote end of file. I switched the read to binary so it would ignore all but the Length Of File. Try this one.

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

Similar Threads

  1. GetRows - Invalid Use of Nulls
    By Wannabe_Pro in forum Programming
    Replies: 3
    Last Post: 07-22-2009, 07:07 AM
  2. List box value to variable - invalid use of null?
    By Orabidoo in forum Programming
    Replies: 2
    Last Post: 05-07-2009, 11:06 AM
  3. Replies: 0
    Last Post: 11-17-2006, 09:38 AM
  4. Invalid Operation
    By ScottG in forum Forms
    Replies: 0
    Last Post: 11-14-2006, 02:05 PM
  5. IMPORT ERROR ..PLEASE HELP
    By fadone in forum Import/Export Data
    Replies: 2
    Last Post: 04-20-2006, 06:36 AM

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