Results 1 to 4 of 4
  1. #1
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72

    Hidden control characters in text file


    Hello all. I've come across an interesting problem that I believe is due to non-printable control characters, etc. At least I "think" this is the problem. The "Trim" function doesn't work as expected for one thing. When I display the record being read in with VBA from a text/html file (using Line Input #1, strRecIn), it appears to be a string of blanks 17 characters long. I've set break points and attempted to display the field in the immediate window and Len(strRecIn) returns 17. When I do a print Len(Trim(strRecIn)), it returns a 1, even though the cursor moves through 4 (seemingly blank) spaces. This in itself is not a problem, but my sequential read through the file seems to be thrown out of order. The text file was actually an HTML file behind a web page from which I'm trying to extract data. Doesn't it appear that control characters (or whatever) are getting in my way? Any help would be appreciated.
    Glenn

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Try to do a "ctrl c" to capture / copy one of the "suspect characters",
    then in your immediate window type

    ?ASC(" then do a ctrl v to paste the single character after the ", then add a trailing ") then hit Enter.

    Access should print out the value of the "unknown character". Here's an example using a Q

    ?Asc("Q")
    81

    You can lookup what this characters is, or you can parse the original string and remove the unwanted characters.

  3. #3
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72
    That was a great idea. The string of "spaces" turned out to be all ASC(32) (blanks) except the last one which was ASC(9).

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You could do a replace of Chr(9) to space or whatever you need.

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

Similar Threads

  1. Replies: 6
    Last Post: 11-08-2013, 11:18 AM
  2. Eliminate Space from Hidden Text Box using CanShrink
    By Casey Sanders in forum Reports
    Replies: 4
    Last Post: 01-29-2013, 06:03 PM
  3. Replies: 4
    Last Post: 09-19-2012, 08:44 AM
  4. Replies: 0
    Last Post: 01-18-2011, 07:09 AM
  5. Help - activate hidden control
    By Belxaviar1973 in forum Forms
    Replies: 2
    Last Post: 08-31-2010, 09:20 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