Results 1 to 13 of 13
  1. #1
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7

    VB Code Disapears Sudenly


    Hi everyone, It's Dany and I'm new here


    In the last three months, I was working on a project using Ms Access 2007, and Few days ago, when I oppened the file, nothing was working. I checked out the VB Code and found that all were gone. I don't know what was the problem. I am trying to rewrite everithing, but it's realy boring.
    Some one told me I should try "Compact and Repair".

    Any help.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would start by importing this db into a fresh, new db and see if the problem follows.
    http://www.btabdevelopment.com/ts/impnew

  3. #3
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    I will try it tonight

  4. #4
    SteveH2508 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    Also check whther the file is in a Trusted Location

  5. #5
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    Last night I tried importimg forms to a new Db file, but nothing happens. Still all codes are missing.

    What do you mean by "Trusted Location "??

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by Dany View Post
    Last night I tried importimg forms to a new Db file, but nothing happens. Still all codes are missing.

    What do you mean by "Trusted Location "??
    Sorry to hear that.
    Here's a link for TRUSTED LOCATION but I don't think that will help in this situation. Did you have any Standard Modules and are they gone as well?

  7. #7
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    What do you mean by "Standard Modules"? BackUps?

  8. #8
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    I Always wondered about That Security Warning, and how can I remove it every time I start the file.
    What about It? and what do you mean by "check whther the file is in a Trusted Location check whther the file is in a Trusted Location"

    I need to Set the folder containing the file as Trusted? What does this work for?

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you follow the link I supplied and set the Trusted Location as suggested? YES, the folder where your file resides needs to be trusted.

  10. #10
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    Did you follow the link I supplied and set the Trusted Location as suggested?
    Yes I did it yesterday and The security warning is gone. But still no VB Codes.

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That sucks Dany! I'm out of ideas. Sorry. Backup...backup...backup.

  12. #12
    Dany is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    7
    Quote Originally Posted by RuralGuy View Post
    That sucks Dany! I'm out of ideas. Sorry. Backup...backup...backup.

    Lesson learned in a hard way.

  13. #13
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    If you find your vba code is suddenly missing (within a form or module), sometimes the culprit is having 2 versions of MSAccess on the same computer and you've imported a form/module from one accdb (or mdb) into another (without debug/compiling). Sometimes though the culprit is opening the same mdb/accdb with different MSAccess versions.

    One way to recover a corrupted form which has lost all vba coding, is to open the mdb/accdb using the /decompile switch. Then delete the form and try re-importing it from a good source backup of the mdb/accdb. After importing, make sure you IMMEDIATELY debug/compile the mdb/accdb after importing (ie. DON'T make ANY coding changes after importing.) Otherwise you might be better off creating a new accdb and then importing all the objects from a backup.

    For more info on the /decompile, see help or this post: https://www.accessforums.net/code-re...pile-8149.html

    Unfortunately there really isn't a way to 'fix' a corrupt form which has lost all vba coding. It does suck though learning how important backups are (the hard way.) Before I update any coding, I always do a copy/paste of the mdb (which only takes a few seconds to do.) Although I rarely need to go to a backup, those few seconds will save me hours of work if need be.

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

Similar Threads

  1. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  2. Code in combobox, code in text box
    By float in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:12 AM
  3. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  4. Help with VBA Code
    By access.newby in forum Forms
    Replies: 1
    Last Post: 11-15-2009, 05:43 AM
  5. Need help with code
    By hoenheim in forum Programming
    Replies: 9
    Last Post: 09-11-2008, 04:19 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