Results 1 to 8 of 8
  1. #1
    MatthewGrace is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2013
    Posts
    117

    Error in SQL statement???

    Hello all, thank you for taking the time to review my quick problem.

    I have a button with one simple line of code. Here is a piece of my table structure (I didn't screen shot all the other fields to the right for simplicity sake).
    Click image for larger version. 

Name:	table.jpg 
Views:	13 
Size:	83.8 KB 
ID:	40220


    When I press the button, Access complains about that one line of code, producing this error:
    Click image for larger version. 

Name:	error.jpg 
Views:	13 
Size:	40.9 KB 
ID:	40221

    Is there something wrong with my syntax?


    In case you're wondering, it doesn't matter whether I set ShipmentFK to 5 or 9999 or any other number. Or Null. There is no forced "Referential Integrity" in the relationships pane or anything cute.

    The crazy part is that I know this code has worked for years... since 2015 I've been running this program and it worked. So when it stopped working at my office and coworkers started complaining, I came home and loaded up a 1 year + old copy. To my shock, this error is still produced on the old copy. Surely we've ran this code many countless times since then and it's always worked.

    Is there a workaround you can think of?
    My goal is to simply change the value of ShipmentFK to Null.
    Yes, I acknowledge that the picture of the table shows a Null value in ShipmentFK already, but in practice it always has a value in it and it still errors.

    Any ideas?
    Thank you so much for any insight,
    Matt

  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
    20,959
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    MatthewGrace is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2013
    Posts
    117
    Thank YOU!

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,959
    Happy to help! That made for a very...exciting...Wednesday last week. I'm still fixing computers, just did another one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,230
    Here's what fixed it for me:

    Click image for larger version. 

Name:	fix.png 
Views:	9 
Size:	70.0 KB 
ID:	40226

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,959
    I think that will only work with O365. Perpetual versions will need to uninstall the offending update or run the fix as it becomes available. Here's a link to all the versions:

    https://support.office.com/en-us/art...3-f21636caedec
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,230
    =pbaldy;443521]I think that will only work with O365.
    If you notice in the image, it's Office Professional Plus 2016. Installed on my machine. Not Office 365.
    Fixed the problem right off.
    Last edited by davegri; 11-19-2019 at 04:24 PM. Reason: fix quote

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,959
    Quote Originally Posted by davegri View Post
    If you notice in the image, it's Office Professional Plus 2016. Installed on my machine. Not Office 365.
    Fixed the problem right off.
    Forgive my poor terminology. Your specific version wasn't relevant to the point I was trying to make, which was that the solution that worked for you will not work for everybody.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 07-15-2019, 10:20 AM
  2. Replies: 4
    Last Post: 03-26-2019, 02:40 PM
  3. Replies: 1
    Last Post: 09-22-2014, 08:54 AM
  4. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums