Results 1 to 9 of 9
  1. #1
    ssissons is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    44

    Access 2007 - VBA code disappearing

    I'm not sure what group this belongs in, so I am putting it in the Programming group.

    We have an Access 2007 database. Users are in it at various points during the day - I don't think they are in it for 8 hours, everyday, but just when it is needed. When it is first opened, a screen is displayed which, during it's Form_Load sub, it displays another screen to select a printer. Two mornings in a row now, when they have opened the DB, it has not displayed the second screen. When I go to look at the first form's code, there ISN'T any! It has disappeared. In fact, ALL of the VBA code behind all of the forms has disappeared. No error messages are displayed.

    What would cause this? Has anybody else experienced this? I have a backup copy of the DB, so I can delete the bad one, and restore it from my copy. So, I can recover. But, why?

    Scott



    p.s. We have other DBs that are not having this issue.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Is this a .mdb ?
    If its compiled (to a .mde or other) you wont see code.

    But I have had this happen where the code vanished from .mdb. I never explained that.
    did someone transfer the objects and forgot the code?

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is the database split? It should be; multiple users in a single copy of a db can corrupt it, which can cause your problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ssissons is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    44
    Ranman -

    It is an .accdb. No, I am the only one making any changes to the DB.

    Paul -

    It is not split. I assume you are referring to front- and back-end?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Hmmm. I'm stumped. Corruption? Got a backup? (always make copies)

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by ssissons View Post
    Paul -

    It is not split. I assume you are referring to front- and back-end?
    Yes, that's what I'm referring to. That would be the number one suspect in my mind. I just split a db for a client that asked me to add some functionality to an old db of theirs and they said it used to corrupt once or twice a week and it hasn't since we split it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    ssissons is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    44
    I'll give the split option a try. Thanks!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. Post back if you get stuck or let us know if that fixes it. Make sure each user has their own copy of the front end.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You may have two separate things going on, here. As to the 'disappearing code,' in the IDE (code window) the Procedure View button may have been accidentally activated. At or near the bottom of the code window, just to the left of the Horizontal Scroll Bars, are two tiny icons, Procedure View and Full Module View. Click on the Full Module View icon and see if your code reappears.

    As for splitting the app, having multiple users sharing a single, non-split database, sitting on a network drive, is the sure way to repeated episodes of corruption, as Paul said, as well as speed and timing problems, and all manner of strange, odd and curious behavior, including the problem you're having, now! Multiple users simply have to work off of a split database, with each user having their own copy of the Front End, which contains everything except the data/tables, on their respective hard drives, and a Back End with only the Tables on a shared drive.

    Being in forced retirement, I spend 8-10 hours a day here and on other Access forums/newsgroups, and over the past eight years have seen literally dozens and dozens of reports of non-split databases causing these kinds of problems as well as massive data lose! The really insidious thing is that a non-split app can work for extended periods of time before the troubles begin! But once it does, they become chronic, which is to say they occur over and over and over again!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Look Up Columns Keep disappearing? Access 2007
    By Amazingmin in forum Access
    Replies: 1
    Last Post: 02-13-2014, 04:27 AM
  2. Replies: 4
    Last Post: 09-05-2012, 08:43 AM
  3. VB Code in Access 2007
    By collen in forum Programming
    Replies: 1
    Last Post: 10-12-2010, 06:27 AM
  4. The amazing disappearing VBA code
    By Michele Keck in forum Forms
    Replies: 2
    Last Post: 10-01-2010, 11:44 AM
  5. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 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
  •  
Other Forums: Microsoft Office Forums