title: How to prevent "OpenForm action was cancelled" in legacy Access Code
body: <p>I recently took over a VERY old Access database.  This database has a TON of macros written that the users utilize to help them navigate and enter data.  Thus, ditching the code is not step #1 despite the fact that these macros were written in Access 97....</p>
  
  <p>I've managed to get most of the code to work by removing deprecated function calls with new ones, but there are a couple of forms that still do not work correctly.  If I can figure out how to resolve one I'm sure I can resolve the others.</p>
  
  <p>The main macro has a menu with several buttons.  Whenever I click one button I get a "The OpenForm action was cancelled" error.  The code for this button is as follows:</p>
  
  <pre><code>Option Compare Database   'Use database order for string comparisons
  
  Private Sub Form_Open(Cancel As Integer)
      If IsLoaded("ServiceCircuit") Then
          Me![PropBtn].Visible = True
      Else
          Me![PropBtn].Visible = False
      End If
  
  End Sub
  
  Private Sub Form_Unload(Cancel As Integer)
      If IsLoaded("ServiceCircuit") Then
          Forms![ServiceCircuit].Visible = True
          Forms![ServiceCircuit]![CircuitPrefix].Requery
          Forms![ServiceCircuit]![CircuitPrefix] = Forms![Circuit]![CircuitPrefix]
          Forms![ServiceCircuit]![CircuitBase].Requery
          Forms![ServiceCircuit]![CircuitBase] = Forms![Circuit]![CircuitBase]
          'Forms!ServiceCircuit.Refresh
          Exit Sub
      Else
          If IsLoaded("DedicatedService") Then
              Forms![DedicatedService].Visible = True
              Forms!DedicatedService.Refresh
              Exit Sub
          End If
  
          If IsLoaded("Property") Then
              Forms![Property].Visible = True
              Forms!Property.Refresh
              Exit Sub
          End If
      End If
  End Sub
  
  Private Sub GRC_GotFocus()
      Me![GRC].Requery
  
  End Sub
  
  Private Sub PropBtn_Click()
      DoCmd.Close
  
      If IsLoaded("ServiceCircuit") Then
          Forms![ServiceCircuit].Visible = True
          DoCmd.Close
          'Forms![ServiceCircuit]![CircuitPrefix].Requery
          'Forms![ServiceCircuit]![CircuitPrefix] = Forms![Circuit]![CircuitPrefix]
          'Forms![ServiceCircuit]![CircuitBase].Requery
          'Forms![ServiceCircuit]![CircuitBase] = Forms![Circuit]![CircuitBase]
          'Forms!ServiceCircuit.Refresh
          Exit Sub
      Else
          If IsLoaded("DedicatedService") Then
              Forms![DedicatedService].Visible = True
              DoCmd.Close
              'Forms!DedicatedService.Refresh
              Exit Sub
          End If
  
          If IsLoaded("Property") Then
              Forms![Property].Visible = True
              Forms!Property.Refresh
              Exit Sub
          End If
      End If
  
  End Sub
  
  Private Sub Tariff_NotInList(NewData As String, Response As Integer)
      dumbvar = AddRecFromCombo(NewData, "Tariff")
  
      '  Continue without displaying default error message.
      Response = DATA_ERRCONTINUE
  
  End Sub
  </code></pre>
  
  <p>I'm VERY new to VB and have been fumbling my way around it with success but I'm stumped as to how I can tackle this or what the issue could be.</p>
  
  <p>UPDATE:</p>
  
  <p>I set a breakpoint in the main menu form.  The code for the actual button is:</p>
  
  <pre><code>Private Sub CircuitBtn_Click()
  On Error GoTo Err_CircuitBtn_Click
  
      Dim DocName As String
      Dim LinkCriteria As String
  
      DocName = "Circuit"
      DoCmd.OpenForm DocName, , , LinkCriteria
  
  Exit_CircuitBtn_Click:
      Exit Sub
  
  Err_CircuitBtn_Click:
      MsgBox Err.description
      Resume Exit_CircuitBtn_Click
  </code></pre>
  
  <p>Stepping through the <code>DoCmd.OpenForm DocName, , , LinkCriteria</code> code runs and then it jumps down to <code>Err_CircuitBtn_Click</code>.  I do not believe I can set a breakpoint elsewhere.  Unsure why this is jumping to the error, the other buttons on the main form are coded the same way (on the main form that is).  I tried setting some breakpoints in the first chunk of code (code for the form once it is suppose to pop up) but the breakpoint is never caught.  I'm guessing that breakpoint should never be reached as that is the script that is executed if I hit a button ON that form, correct?</p>