Mysterious Access Crash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1288

    Mysterious Access Crash

    Dear Access Community,

    I have a puzzle for you. I believe this puzzle has already been presented here, similarly but differently. The essence of the puzzle is, why does my Access program crash with the message "Microsoft Access has stopped working?"

    This program is a form with 17 list boxes and a few other objects. It's called Pick Queue. It is used by the staff to see all manner of information about pick tickets, waiting to print, waiting to be packed, credit card denied and on and on.

    There is one particular workstation on which this program crashes immediately. You don't even see a single list box appear, it just goes right to Microsoft Access has stopped working. To complicate things, this workstation has only the runtime Access installed, so there is no using the debugger.

    In an effort to track down the problem today, I added this code at the top of Form_Load subroutine:
    Code:
    Dim logCtr As Integer ' counter variable
    Dim tLog As LogTextFile_cls ' class for creating log file
    Set tLog = New LogTextFile_cls ' establish a log file
    tLog.LogFile = "PQTest" ' name the log file
    LogTextFile_cls is a class I created long ago to simplify log-making.

    I added this code after a number of pre-existing statements in the subroutine.
    Code:
    logCtr = logCtr + 1 ' identify where we are in sequence
    tLog.LogThis logCtr ' make a log entry - just do something
    My idea was not to "just do something", I wanted to get a log file that would tell me how far along it got in the code before crashing. Well, it didn't crash. All log entries were made and the workstation was perfectly happy to run the Pick Queue program.

    So, next I commented out tLog.LogThis logCtr, it became 'tLog.LogThis logCtr. And the program crashed. I commented some out and left others. The program crashed.

    I replaced
    Code:
    tLog.LogThis logCtr ' make a log entry - just do something
    with
    Code:
    MsgBox logCtr ' just do something
    The program runs fine, all 9 message boxes pop up and the program does not crash.

    The last thing I did this morning, before the warehouse crew started work, was to comment out the MsgBox statements. Of course that is the same thing as commenting out the log making entries. But I did it anyway and the program started up just fine. Now that makes no sense at all.

    I want to emphasize that I was very careful about doing this. I have version copies of each step along the way. I can repeat this testing process easily. But, I do not include the very last test in this disclaimer, because a phone call came in and I was a little rushed. So I feel like I need to verify the code with the Msgbox statements commented out. But it was done with a very simple find/replace operation, so my confidence is pretty high.

    Maybe I can do more experimenting another morning before the staff begin their work day.

    Have you any idea what's going on?

    zz0.isxz7iz9qvo zz
  • cactusdata
    Recognized Expert New Member
    • Aug 2007
    • 223

    #2
    Sometimes when things run to weird - beyond common sense, as you have experienced - the editor has done something behind the scene.
    What cures it, is to remove the stubborn code lines and rewrite them not using copy-paste.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      "rewrite them not using copy-paste."
      Sometimes, you can even rewrite them WITH a Cut/Paste. Possibly do a Compile between the steps.
      NB. The Cut removes them first & this is a critical step for this approach to work, just as Cactus suggests in his post.

      If that doesn't work - & it may well not - then go ahead and take the longer route. With multiple lines of code though, test frequently. If it stops working at any point you can then focus on just the code between that test & the one that last succeeded & that should keep your life a little simpler.

      Comment

      Working...