Share via

Issue closing form

Anonymous
2024-02-15T22:19:24+00:00

Below is my on enter code for txt_GAID_Enter. When entering the textbox it tests for a couple of conditions and then closes the form. Well, that is the intent anyway. When it gets to the close form line it returns an error "This action can't be carried out while processing a form or report event.". Not sure what event it would be referring to.

Private Sub txt_GAID_Enter()

'On Error Resume Next

'By-Passes Per Capita check it Aerrie is from out of state 

    If txt\_PerCapita\_Status = "NA" Then 

        Exit Sub 

    End If 

'Tests that Per Capita's have been paid 

    If txt\_PerCapita\_Status = "Not Paid" Then 

        MsgBox "This Aerie has not paid their Per Capita taxes and therefore cannot register Delegates for convention." & vbCrLf & vbCrLf & \_ 

                       "This form will now close." 

    End If 

'Tests that Additional Allowed Delegates is greater than 0 

    If txt\_AdditionDelegates\_Allowed = 0 Then 

        MsgBox "This Aerie has already used their Allowed Delegates." & vbCrLf & vbCrLf & \_ 

                       "This form will now close." 

    End If 

    DoCmd.Close acForm, "frm\_Registration", acSaveNo 

End Sub

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2024-02-16T18:03:29+00:00

    Thank you. That did the trick.

    Was this answer helpful?

    0 comments No comments
  2. George Hepworth 22,855 Reputation points Volunteer Moderator
    2024-02-16T00:20:13+00:00

    The proper event for Validation code is the Before Update event. Depending on what you are validating that could be the control's BeforeUpdate or the form's BeforeUpdate.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,830 Reputation points Volunteer Moderator
    2024-02-15T22:23:23+00:00

    We would need to see what other code procedures are in the module. Especially in the Open, Load and Current events.

    Was this answer helpful?

    0 comments No comments