Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941

    Unanswered: Code not Executing

    I have several forms that I use as "pop-up" forms in my app.
    Typically, I'll open one of these forms using a cmd button on a main form.
    I use:
    DoCmd.OpenForm strForm_name, , , strCriteria, , acDialog
    to open the forms.

    Once in a while, if I have an untrapped error on the "pop-up" form, I'll
    get an error message. If I select "end", instead of debug, then the form stops responding. For example, if I click on the "Exit" button I've designed,
    I can tell that the focus is moving to that button, but the code behind the button doesn't run. The only way I've found to get out of Access at that point is through Ctl+Alt+Delete.

    Also, I turn off the Min/Max/Close buttons on all my forms, to force the user
    to use Exit buttons I've designed. Somehow, I think this carries over to objects other than form. I may open a table in datasheet view, and there will be no "X" in the upper right hand corner of the window to close it. I have to use File Close. The min/max buttons are still displayed, however.

    Anybody seen this before?

    Thanks
    Inspiration Through Fermentation

  2. #2
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244
    I think the general point is that you should never have untrapped errors. ALL of your code procedures should contain an error handler to stop your application failing.

    Incidentally, instead of pressing Ctrl-Alt-Delete, try pressing Alt-R. This should enable you to reset the error and continue.

    Not sure about your Close button problem, but rest assured that form properties are never inherited by tables.
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.com

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    What has happened to me in the past is the control will lose the event trigger (so the code won't be called) ... Have you tried pulling up the properties of the controls and enabling the events you desire (and have coded)?
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Quote Originally Posted by M Owen
    What has happened to me in the past is the control will lose the event trigger (so the code won't be called) ... Have you tried pulling up the properties of the controls and enabling the events you desire (and have coded)?
    Thanks

    Can you elaborate a little on the second statement? I'm not quite sure
    I follow what you're saying.
    Inspiration Through Fermentation

  5. #5
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Quote Originally Posted by andybriggs
    I think the general point is that you should never have untrapped errors. ALL of your code procedures should contain an error handler to stop your application failing.
    If only the average user/developer had that much time...

    Incidentally, instead of pressing Ctrl-Alt-Delete, try pressing Alt-R. This should enable you to reset the error and continue.
    I wasn't aware of that shortcut. I'll try that next time it happens.

    Thanks
    Inspiration Through Fermentation

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by RedNeckGeek
    Thanks

    Can you elaborate a little on the second statement? I'm not quite sure
    I follow what you're saying.
    If you open your form in design mode and right-click on a control and select "properties" then scroll down to where the events are ...
    Back to Access ... ADO is not the way to go for speed ...

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I'm sorry if I'm missing something obvious here...

    My code behind the control works 99.9% of the time. At no point am I setting the Enabled property to No via code. If I scroll down to my OnCLick event,
    it's still says [Event Procedure] and the code in the event procedure is still there.

    What else are you suggesting I look for?
    Inspiration Through Fermentation

  8. #8
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by RedNeckGeek
    I'm sorry if I'm missing something obvious here...

    My code behind the control works 99.9% of the time. At no point am I setting the Enabled property to No via code. If I scroll down to my OnCLick event,
    it's still says [Event Procedure] and the code in the event procedure is still there.

    What else are you suggesting I look for?
    Well, you validated one of my questions. Did you try setting a breakpoint and stepping thru? If that does not work, then try recreating your form (and here just do this: create a new blank form. Copy and paste the controls from the original, and copy and paste the underlying code. Recompile).
    Back to Access ... ADO is not the way to go for speed ...

  9. #9
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    On the occasions that I select Debug instead of End, I'll fix the cause and let the code finish executing. However, if I select End, that kills all the code behind the form. When I have time to look for the cause, I can't duplicate the problem. When I don't have time, of course it happens immediately!

    It's just that I'm curious about what causes that to happen. I'll eventually
    implement the solutions that both you and AndyBriggs have suggested, but not until after I figure out why it happens!

    Thanks
    Mark
    Inspiration Through Fermentation

  10. #10
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Quote Originally Posted by RedNeckGeek
    I have several forms that I use as "pop-up" forms in my app.
    Typically, I'll open one of these forms using a cmd button on a main form.
    I use:
    DoCmd.OpenForm strForm_name, , , strCriteria, , acDialog
    to open the forms.
    ....

    I turn off the Min/Max/Close buttons on most (edit) of my forms, to force the user to use Exit buttons I've designed. Somehow, I think this carries over to objects other than form. I may open a table in datasheet view, and there will be no "X" in the upper right hand corner of the window to close it. I have to use File Close. The min/max buttons are still displayed, however.
    UPDATE:

    I found one form in particular that causes this behavior. The properties
    that should effect this are set as follows on the form:

    Pop Up = No
    Modal = No
    Border Style = Sizable
    Control Box = No
    Min Max Buttons = None
    Close Button = No

    Once I open this form, I lose the "X" close control in the DB window, tables, queries, etc. If I open any other form that I've left the Close button on, it comes back on in all of the other windows. Maybe these windows aren't supposed to inheret the property from the form, but it appears that they are.

    Very strange... I'll have to drink on it.
    Inspiration Through Fermentation

Posting Permissions

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