Results 1 to 6 of 6
  1. #1
    djs79 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    7

    Line Breaks Causing API Problems

    Hello everyone, I'm running into a really strange issue and could really use some help.

    I'm using MS Access to make an API Call in order to sync data to a website. The API URL includes a lot of parameters and tends to get very lengthy.
    90% of the time, the API Call works fine, and the data gets posted to the website, however there are a handful of times when it fails, and I've only found one way to fix the issue:

    When I 'Debug.Print' the URL, it appears as one long, solid string of text, with no line breaks. However, when I copy/paste the URL into another program, such as MS Word or DreamWeaver, there are about 5 or 6 random line breaks, throughout the URL, that shouldn't be there. If I manually delete those line breaks (while in MS Word), and then copy/paste that corrected URL into the address bar on my browser window, the API Call goes through successfully.



    I have no idea why these line breaks are being created (they're not a part of the data that I'm trying to post), but I think they are breaking my API Call.

    Does anyone have any idea what's going on here?
    Thanks in advance!
    DJS

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    not really but analysis the string to determine which linebreak characters and perhaps spaces (there are a number of possibles) are being used - something like

    for I=1 to len(url)
    debug.print mid(url,i,1); asc(mid(url,i,1))
    next I

    then use a replace function to remove them - something like

    replace(replace(url,chr(10),""),chr(13),"")

  3. #3
    djs79 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    7
    That was a great suggestion. And after running that function, I can now see that there are actually no line breaks where I thought there were. So now I'm even more baffled than I was in the beginning, BUT your suggestion helped me rule out my "line break" theory.

    Thanks for your help!
    DJS

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    The line breaks are probably inserted by the application software (word,dreamweaver...) to provide readability.
    Can you how us the api call and the app you are using?

  5. #5
    djs79 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    7
    I think you're right ... I believe the other applications were adding those line breaks, because they were not being generated by Access. As for my issue, I actually figured it out. I was getting a "414 - URI Too Long" error, and didn't realize it, because, as I just learned, that particular response does not include an <error> element, which my code was specifically looking for in order to handle errors. Thanks for the feedback.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

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

Similar Threads

  1. Replies: 14
    Last Post: 01-08-2015, 04:50 PM
  2. Referential Integrity Causing Me Problems
    By Dave D in forum Database Design
    Replies: 3
    Last Post: 06-21-2014, 05:04 PM
  3. Export Fixed Width with No Line Breaks/Carriage Returns
    By jpfulton248 in forum Import/Export Data
    Replies: 5
    Last Post: 01-17-2014, 12:41 PM
  4. Eliminate line breaks in exported report
    By thekruser in forum Reports
    Replies: 3
    Last Post: 09-28-2010, 08:57 PM
  5. vbCrLf is causing square box on last line
    By cowboy in forum Programming
    Replies: 1
    Last Post: 03-24-2010, 10:01 AM

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