Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > Forums > Developers
Back to Access Developer Forum    Comments List
OpenAI Tech Help Upload Images   Link   Email  
Ashlyn Talley       
2 months ago
Hello, I'm trying to put to good use the OpenAI Tech Help video(s). Everything has worked stellar so far, but unfortunately, on my final API submission, I'm receiving an error due to my send string containing tabs, line breaks, carriage returns, etc. I've tried a couple of approaches, using both the Replace function and/or the RegEx, including searching the web along with trying to have ChatGPT help with problem-solving. It seems like there must be a script out there to thoroughly clean a string, no?
John Davy           
2 months ago
Hi Ashley
Not sure what's going on but I use the Open AI App that Richard made with no problems. Can you show us the error that you are getting?

Sami Shamma             
2 months ago
Hi Ashlyn,

I had the same problem. With help from Richard's code volt, the following function saved the day:

Public Function DeleteTrailingChar(ByRef S As String) As String

    While Len(S) > 1 And (Right(S, 1) = Chr(10) Or Right(S, 1) = Chr(13) Or Right(S, 1) = " " Or Right(S, 1) = """""" Or Right(S, 1) = Chr(9))
        S = Left(S, Len(S) - 1)
    DeleteTrailingChar = S
End Function

To use it, just call it to process your string:

S = DeleteTrailingChar(S)
Ashlyn Talley       
2 months ago
Thank you both John & thanks Sami for the suggestion to use the DeleteTrailingChar function before my SendStr to the API, unfortunately, on first blush, this didn't solve my dilemma. I have the API helping me to update an ongoing list of assessments that are on my caseload, which involves having VBA copy a previous response to another text box and combining it with more content to then use in another SendStr to generate a response. Something is happening during this process, some tab, line break or character that, despite all of my efforts I'm not able to remove before attempting to send.  I changed a bit of the VBA trying to copy and paste an output here that I could use as an example, now all of a sudden it seems to be working fine. I have hardcoded a hyperlink to an online site that has a cleanup utility that afterwards using I've been absent of a problem. Perhaps if the error returns, I'll make use of that until if and when it becomes bothersome.

BTW, Richard ROCK'd with this TechHelp, never imagined I could press buttons and have Access generate in minutes something that would take me near an hour to complete with half the quality or sophistication. Thanks again!
Richard Rost             
2 months ago
Yeah it's just a matter of stripping out characters that cause issues. Trial and error.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.


The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/20/2024 10:28:02 PM. PLT: 1s