Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52

    Characters found after end of SQL statement. Report Print Preview

    Good morning. I am a self-educated idiot and am having a problem with a report.

    I have Microsoft 365 Apps for enterprise
    Access 2008 Click to run

    When I open the report in print preview, it gives me:

    Characters found after end of SQL statement.

    If I click "Ok" it opens.

    I rebuilt the query from scratch and it still does it. I have another report from another query that works fine. I have compared the two and can't see any difference.

    Here is the SQL for the offending query:

    SELECT Personnel.[Last Name], Personnel.[First Name], Personnel.Craft, Personnel.[Cell #], Personnel.[Team Email], Personnel.[CPC Email], Personnel.Group, Personnel.Active
    FROM Personnel
    WHERE (((Personnel.Active)=True));



    I have also tried yes.

    I did delete one column from this query because I didn't need it anymore.

    Help would be appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Does the query run without error on its own? I don't see anything wrong with the SQL offhand. If the query opens but the report errors, look for something in the Filter and Order By properties of the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Quote Originally Posted by pbaldy View Post
    Does the query run without error on its own? I don't see anything wrong with the SQL offhand. If the query opens but the report errors, look for something in the Filter and Order By properties of the report.
    Yes, the query runs fine on it's own. The report opens fine in report and layout view. It's just print preview.

    I removed the group and sort from the report and still get the message.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Just curious if one of the fields in your query might contain a semi-colon (maybe multiple emails)? You could use Replace to replace it with a comma if that is the case.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Quote Originally Posted by Gicu View Post
    Just curious if one of the fields in your query might contain a semi-colon (maybe multiple emails)? You could use Replace to replace it with a comma if that is the case.

    Cheers,
    Double checked, not a one.

  6. #6
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    It seems like it started after I deleted the field from the query, but I'm not 100% sure.

  7. #7
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Could it be a colon in the table the query is pulling from?

    I looked, not one there either. There are two email addresses, but not in the same field.

  8. #8
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    What I really don't understand is why I only get the error on print preview

  9. #9
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Put some square brackets around the Personnel.Group,

    Personnel.[Group],

    I think it's a reserved word and could be confusing the report object (which uses grouping)?

    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  10. #10
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Quote Originally Posted by Minty View Post
    Put some square brackets around the Personnel.Group,

    Personnel.[Group],

    I think it's a reserved word and could be confusing the report object (which uses grouping)?

    Done, no change. Yes, the report groups on "Group".

    So does my other query and report that doesn't have the error.

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Try to recreate the query from scratch with a new name and use that in the report.

  12. #12
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Done. Same error message.

  13. #13
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    Quote Originally Posted by pbaldy View Post
    Can you attach the db here?
    No, sorry.

  15. #15
    OlBill is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2021
    Posts
    52
    So I made another report and pulled it from the same query. It didn't have the error.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Characters Found After SQL Statement Error!
    By Dreamweaver in forum Programming
    Replies: 1
    Last Post: 04-15-2020, 04:29 PM
  2. Replies: 3
    Last Post: 04-28-2017, 09:51 AM
  3. Replies: 5
    Last Post: 08-06-2015, 03:26 PM
  4. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  5. Replies: 6
    Last Post: 03-01-2014, 07:07 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