Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    559

    Unanswered: Error 91 : Block not set?

    Has anyone ever gotten this error message? I tried to restore my db to a previous one, which worked, but the 'reminders' ask me if I want to open it and I select yes, it used to open a form with the reminders, now it doesn't. Just gives me that error and if I try to debug it it'll just exit and not let me see where the error is....

    Ok... Managed to get the debug working... In the code below, it highlights "If ctlNew.Name = ctlSave.Name Then :::


    **What's bugging me is that it worked like a week ago but now it doesn't. I know it has to do with the InactiveTimer portion **


    Code:
    Private Sub Form_Timer()
    '**********************************************************************
    '* This timer event procedure will shut down the application
    '* after a specified number of minutes of inactivity. Inactivity
    '* is measured based on how long a control remains the ActiveControl.
    '**********************************************************************
    Dim sngElapsedTime As Single
    Dim ctlNew As Control
    Dim i As Integer
    On Error Resume Next
    
    Set ctlNew = Screen.ActiveControl
    If Err <> 0 Then
        '* No activecontrol
        sngElapsedTime = Timer - sngStartTime
        Err.Clear
    Else
        If ctlNew.Name = "InactiveShutDownCancel" Then
            '* The warning form has appeared, and the cancel button
            '* is the active control
            sngElapsedTime = Timer - sngStartTime
        Else
            If ctlNew.Name = ctlSave.Name Then
                '* Still at same control
                sngElapsedTime = Timer - sngStartTime
            Else
                '* Some change has occured, we're at a new control
                Set ctlSave = ctlNew
                sngStartTime = Timer
            End If
            If Err <> 0 Then
                Set ctlSave = Screen.ActiveControl
            End If
        End If
    End If
    Err.Clear
    
    Set ctlNew = Nothing
    
    Select Case sngElapsedTime
    Case Is > (intMinutesUntilShutDown * conSeconndsPerMinute)
        '* Set global timeout variable, then shut down each form
        '* This code can be used if there is code in the form's BeforeUpdate,
        '* or OnClose event procedure that requires user input.
        '* The variable "gintInactiveTimeout" can be checked in the form events
        '* and can be used to prevent the user prompt code from executing.
        Dim frm As Form
        
        '* Set the global variable "gintInactiveTimeout" to True if the basISDOptionalModule is included
        Select Case xg_CallIfPresent("isd_SetInactiveTimeoutVar(True)")
        Case 1, 2, 3, 99
            '* We'll accept the results regardless of the return code
        Case Else
        End Select
        
        For Each frm In Forms
            DoCmd.Close acForm, frm.Name, acSaveYes
        Next frm
        
        '* Set the global variable "gintInactiveTimeout" to False if the basISDOptionalModule is included
        Select Case xg_CallIfPresent("isd_SetInactiveTimeoutVar(False)")
        Case 1, 2, 3, 99
            '* We'll accept the results regardless of the return code
        Case Else
        End Select
        Set frm = Nothing
        
        Set ctlSave = Nothing
        DoCmd.Quit acQuitSaveAll
    Case Is > ((intMinutesUntilShutDown - intMinutesWarningAppears) * conSeconndsPerMinute)
        '* Make the warning form visible if it is not already visible.
        If Me.Visible Then
        Else
            Me.Visible = True
            
            If conPopUpISDFormForeground Then
                '* Un-minimize Access application if it is minimized
                If IsIconic(Application.hWndAccessApp) Then
                    ShowWindow Application.hWndAccessApp, SW_RESTORE
                End If
                '* Make it the foreground window - open it in front of other application windows.
                SetForegroundWindow (Me.hwnd)
            End If
            
            '* Open it on top of other modal windows.
            SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
        End If
    Case Else
        '* The next line can be commented out if the form is opened hidden
        'Me.Visible = False
    End Select
    
    
    Me.txtMinsSecs = sngElapsedTime '& " minutes " & secs & " seconds before shutdown" 'added for countdown timer to display to user
    
    Exit_Section:
    End Sub
    Last edited by Grafixx01; 07-03-07 at 13:26.

  2. #2
    Join Date
    Aug 2006
    Posts
    559
    Ok, now I'm kind of mad! I just loaded the DB on another machine on the network and it works fine. ARGH!!!

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Make sure that you're actually hitting the line in question during your testing, as the problem line is within the Else portion of an If/Then statement. I see no way that line executes if that variable hasn't been set, as noted on another site you have the same question posted.
    Paul

  4. #4
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by pbaldy
    Make sure that you're actually hitting the line in question during your testing, as the problem line is within the Else portion of an If/Then statement. I see no way that line executes if that variable hasn't been set, as noted on another site you have the same question posted.
    I think what you're saying is why it's not working on that one machine. The "ctlSave" is not set, but the "ctlNew" is saved / defined in the beginning of the code.

    I wonder though why it works on two other machines but not on my machine?

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I'm saying that when you test it on the other machines, to make sure the conditions are such that it will hit that line of code. IOW, this has to be false:

    If Err <> 0 Then

    as does this:

    If ctlNew.Name = "InactiveShutDownCancel" Then

    so that it gets to the Else portion of the second If/Then. If it doesn't process that line, it probably won't error (I can't think if that would throw a compile error or not). I'll be surprised if any PC will process that line without error, since ctlSave hasn't been set.
    Paul

Posting Permissions

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