Results 1 to 9 of 9
  1. #1
    Ender653 is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Nov 2024
    Posts
    4

    MS Access Code Suddenly Stopped Working

    Good Morning,



    I have an Access database that I built with Access 2016. In June everything was working fine. Then I went away for the summer, and upon return, the code no longer works. My first instinct says MS updates pooched it. But I took the code to my laptop which has Office 365 and tried to run it there. The same error occurs.

    FYI: The first line that kicks is the following:

    forms!frmShipmentHdr!frmShipmentSerials.Form.Allow Edits = True

    Produces runtime error 2455 You entered an expression that has an invalid reference to the property form/report.

    I've recompiled the database. I've done a compact/repair. I've even recreated the DB by creating a new DB and importing all objects. All references show valid; none are missing. Still getting the same thing.

    And its not just this, I'm getting errors trying to hide buttons on the form etc. Again, bear in mind, that all code was functional and operating properly.

    I'm at a loss on how to proceed. Thoughts?
    --
    Brian

  2. #2
    Ender653 is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Nov 2024
    Posts
    4
    Wrong environment posted above. Workstation is Windows 10 Pro.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Code:
    forms!frmShipmentHdr!frmShipmentSerials.Form.Allow Edits = True
    for starters there appears to be an extra space in AllowEdits.

    Do you have option explicit declared in all modules?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Quite possibly space was thrown in by forum. It does that regularly - can't remember why. Post code between CODE tags and should not happen.

    Could provide db for analysis. Follow instructions at bottom of my post.

    Suggest you edit your forum profile.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ender653 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2024
    Posts
    4
    The extra space was mine typing the line displayed on the other machine. False alarm.

    But yes, Option Explicit is in all modules. And like I indicated, all code was working in June and then not after the summer.. I can see that maybe Access 2016 isn't supported and so ported to a machine with Office 365. Still doesn't run in that environment (but had previously worked on the laptop as well).

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Forum injects a space every 50 characters when tags are not used. Why anyone thought that would be a good idea is a mystery to me.

    You don't say when this error occurs but I'm guessing it is when your form(s) are opened. If you are not the only one who can edit db design I'd check the object names. If the form opens, test that via the immediate window. I sometimes do this in the immediate window:
    ?forms!frmShipmentHdr.Name and if the reference is valid it will prove it. Then I move on to the next object in the chain (i.e. subform control). Then I'd test the name of it's source object, and so on. Don't forget that subforms load first so trying to reference anything in the main form from within subform code is likely to fail.

    I've seen a few cases of where code that was never quite right fails all of a sudden because of Access updates but that's probably not the issue here. I suggest adding a newly built but simple version of your form/subform and try setting that property. You don't need all the buttons and other stuff to test if this issue is at the app level or if your form is corrupted. Importing a corrupt form into a new db is not likely to fix the corruption.
    Last edited by Micron; 11-04-2024 at 10:57 AM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    As June suggested, perhaps you could post a copy of the database.

  8. #8
    Ender653 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2024
    Posts
    4
    Final resolution: The form in question was had 2 subforms. One of the 3 forms had become corrupted. I was able to import the 3 relevant forms from backups 3 versions earlier, and re-apply the changes made in those 3 updates. All good.

    So, as indicated, there was nothing wrong with the coding. Access just went a little sideways. Perhaps a power glitch corrupted one of the forms?
    --
    Brian

  9. #9
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Posts 8/9 crossed in universal time. No longer applies.

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

Similar Threads

  1. Replies: 9
    Last Post: 11-26-2022, 10:44 AM
  2. Replies: 7
    Last Post: 08-07-2020, 11:04 AM
  3. Replies: 8
    Last Post: 11-02-2014, 01:27 AM
  4. Embedded Form Suddenly Stopped Working
    By ResearchRN in forum Access
    Replies: 3
    Last Post: 03-14-2014, 07:19 AM
  5. Replies: 5
    Last Post: 06-13-2012, 05:08 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