Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2001
    Posts
    45

    Question Unanswered: What's wrong with this code?

    I have some extreme problems with a function inside a form that updates some of the displayed elements.

    The code ist here: http://www.midiport.de/problem.htm

    Has anybody a clue whats the problem here? Access crashes big big time with the code! (Not even an Error Message). I appreciate any comments! :-)

  2. #2
    Join Date
    Nov 2002
    Posts
    150

    Re: What's wrong with this code?

    Originally posted by waldemar
    I have some extreme problems with a function inside a form that updates some of the displayed elements.

    The code ist here: http://www.midiport.de/problem.htm

    Has anybody a clue whats the problem here? Access crashes big big time with the code! (Not even an Error Message). I appreciate any comments! :-)
    Try putting a breakpoint on the first line and stepping through. Go slow so you can tell which line it crashes on.

  3. #3
    Join Date
    Nov 2001
    Posts
    45
    Gee, I totally forgot about that :-)

    I get interesting "regular" errors now :-)

    Well it looks like

    Set rsDetailsCopy = Me.subEditSingleReportEntries.Form.RecordsetClone

    is causing some trouble. Sometimes the object is available, sometimes it's not. Even with

    If rsDetailsCopy.EOF = False Or rsDetailsCopy.BOF = False Then

    right afterwards I can not avoid this problem... this is very puzzling to me...

  4. #4
    Join Date
    Nov 2002
    Posts
    150
    Originally posted by waldemar
    Gee, I totally forgot about that :-)

    I get interesting "regular" errors now :-)

    Well it looks like

    Set rsDetailsCopy = Me.subEditSingleReportEntries.Form.RecordsetClone

    is causing some trouble. Sometimes the object is available, sometimes it's not. Even with

    If rsDetailsCopy.EOF = False Or rsDetailsCopy.BOF = False Then

    right afterwards I can not avoid this problem... this is very puzzling to me...
    Maybe wrappping that code in an IF will handle it. Something like:

    If 0 <> Me.subEditSingleReportEntries.Form.RecordsetClone. RecordCount Then
    Set rsDetailsCopy = Me.subEditSingleReportEntries.Form.RecordsetClone
    ...
    ...
    ...
    End If

  5. #5
    Join Date
    Nov 2001
    Posts
    45
    Thanks! But it must be something totally different. I removed the whole recordsetclone-stuff and:

    Access still crashes...

    VEEEERY interesting: By stepping through the code (F8) it WON't crash!!!

  6. #6
    Join Date
    Nov 2001
    Posts
    45
    Here it comes:

    Access crashes only when the function (updateDisplay()) is called two times with very little time in between!

    I have two buttons (I guess this obvious from the code) that call this function. If I press them slowly (waiting several seconds in between) everything works fine. But as soon as I click faster ----> CRASH

    Is this some sort of Access outrunning itself ????

  7. #7
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Originally posted by waldemar
    Here it comes:

    Access crashes only when the function (updateDisplay()) is called two times with very little time in between!

    I have two buttons (I guess this obvious from the code) that call this function. If I press them slowly (waiting several seconds in between) everything works fine. But as soon as I click faster ----> CRASH

    Is this some sort of Access outrunning itself ????
    if you are using querydefs/recordsets maybe they are not getting closed correctly?????
    Jim

  8. #8
    Join Date
    Nov 2002
    Posts
    150
    Originally posted by waldemar
    Here it comes:

    Access crashes only when the function (updateDisplay()) is called two times with very little time in between!

    I have two buttons (I guess this obvious from the code) that call this function. If I press them slowly (waiting several seconds in between) everything works fine. But as soon as I click faster ----> CRASH

    Is this some sort of Access outrunning itself ????
    Hmmm, who knows. Try this. In the click event, call updateDisplay() and then DoEvents. Then try clicking on it fast again.

  9. #9
    Join Date
    Nov 2001
    Posts
    45
    DoEvents alone didnt make any difference.

    With this code however I get at least an error message before access crashes the *next* time I click:

    (inside the function
    Do While IsFormLoaded(**FORMNAME**)
    DoEvents
    Loop

    (extra-function
    Function IsFormLoaded(pstrFormName As String) As Integer
    IsFormLoaded = SysCmd(SYSCMD_GETOBJECTSTATE, A_FORM, pstrFormName)
    End Function

    Well, now it complains it couldnt save some record's data and then comes the next crash (BTW I'm using Access 2002 with the latest SP 2).

    Maybe I should include some code to wait 3 seconds before the user is allowed to anything again . Seriously, I believe this DoEvent thing is going in the right direction, but so far it doesnt solve the crisis

Posting Permissions

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