Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2010
    Posts
    85
    Provided Answers: 2

    Exclamation Unanswered: Command button codes missing after crash

    I have a DB that contains a number of forms all with command buttons.

    Yesterday, after a computer crash, for some inexplicable reason none of the command buttons now no longer work. None of them

    If I look at the DB all the data is there.

    If I look at the properties of the command buttons on the forms all the Code is missing.

    I have managed to fix the DB command buttons by copying the forms from a backup copy to the DB but I'm bewildered as to why or how this has happened.

    Any ideas???

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Don't be bewildered, just accept its one of Access's foibles. there's a heck of a lot going on under the hood in an Access application. Im guessing there was a corruption which caused the link between the code and the from to become invalid

    but there are things you cna do
    first off split the DB into:-
    a back end that contains all the data, all the common queries, this should be on a server as a file share
    a front end containing the user interface, all forms, reports, local queries and so on. ideally the front end should be deployed to each users workstation or desktop

    have two pairs of files, one front & back end pair are for development, the other pair are the live system.

    ideally deploy the live front end as an MDE or ACCDE, but if you do deploy as an MDE and ACCDE then make certain you have a working copy of the MDB/ACCDB and do not delete them, otherwise you are stuffed with a capital F.

    periodically compact and repair your db files so that the indexes are in good condition in the data and the old working files are removed from the user interface
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2010
    Posts
    85
    Provided Answers: 2
    Thanks for the reply. You're right of course on a number of levels.

    Splitting the DB is something I've been wanting to do but been putting off. Seems like now might be a good time.

    I have always been fastidious about backups and dev and live versions. I write the stuff, but there are currently 20 odd users in various locations that use it, so deploying the split DB has always seemed a bit daunting.

    Since repairing the DB I have just found that one of the command buttons is still not working. It is a button that calls for a password to be entered before opening another form.

    I get the error. "Compile Error - User-defined type not defined" and the VB window opens highlighting the offending line.

    Code:
    Private Sub Form_Open(Cancel As Integer)
       Dim Hold As Variant
       Dim tmpKey As Long
       Dim I As Integer
       Dim rs As DAO.Recordset
    I have checked everything I can think of and copied all the modules from my working backup to the damaged db but still get the error.

    I'm thinking that I need to do something manual in the db itself, but it's been so long since I implemented this code I can't recall what it is.

    Do you have any idea?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    check the references in the VBA project (the code window) include DAO library. newer versions of Access tend to omit DAO in favopur of ADO
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Sep 2010
    Posts
    85
    Provided Answers: 2
    Hi Healdem

    You're right

    The DB also lost the library link.

    Thank you very much for your help.

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by sheusz View Post

    ...Splitting the DB is something I've been wanting to do but been putting off. Seems like now might be a good time...
    Absolutely! 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 kind of problem, as well as a multitude of others and massive data loss!

    The really insidious thing about this 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)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •