Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access AI Builder    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Runtime Error 3142
Filoteo Franco 
   
11 months ago
Hi. Can anyone help me fix this error? Characters found after end of SQL statement.
Whenever I run the query, It only works when I remove these extra characters at the end of the SQL:
",
"refusal": null,
"annotations": []


The generated SQL Code:
SELECT CustomerT.CustomerID, CustomerT.FirstName, CustomerT.LastName
FROM CustomerT
WHERE CustomerT.IsActive=True;",


"refusal": null,
"annotations": []


This is where the error points when I click the debug button:
DetailsPrivate Sub ViewResultsBtn_Click()

    Dim db As Database
    Dim Q As QueryDef

    Set db = CurrentDb()
    On Error Resume Next
    DoCmd.DeleteObject acQuery, "TempQ"
    On Error GoTo 0
    Set Q = db.CreateQueryDef("TempQ", OpenAIResponse)
    DoCmd.OpenQuery "TempQ", acViewNormal
    'db.QueryDefs.Delete "TempQ" ' put this line in if you want TempQ deleted after it runs
    Set Q = Nothing
    Set db = Nothing
        
End Sub

Appreciate your help.
Filoteo Franco OP  @Reply  
   
11 months ago

Sami Shamma  @Reply  
             
11 months ago
Hi Richard, OpenAI has changed what it returns in the Jason script since you did this Template.

Adding an addendum will be very helpful

Thank you
Richard Rost  @Reply  
          
11 months ago
Yeah, you just have to truncate those off of the end of there. I'll try to put together an addendum when I get some extra time, but it's literally just chopping those extra characters off the end using the string functions.

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

Next Unseen

 
New Feature: Comment Live View
 
 

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

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

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 3:49:17 PM. PLT: 1s