Share via

Form vba allow edit

Anonymous
2020-01-03T05:37:40+00:00

Hello,

I have a continuous form with the below vba and it helps protect records from accidental modifications and deletions. All is good however I recently added a floating field to the Form header called "SearchField" so that I can use it in a parameter query but because of the below vba it won't let me type anything into the "SearchField". How can I modify the below to allow me to type in the "SearchField" and also keep my records in the continuous form safe?

Private Sub Form_Current()

Me.AllowEdits = IsNull(Me.[Locked On])

Me.AllowDeletions = IsNull(Me.[Locked On])

End Sub

Your help is greatly appreciated.

Iram/mcp

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

Answer accepted by question author

Anonymous
2020-01-03T09:28:27+00:00

You can use the Enter and Exit events of the textbox:

Private Sub SearchField_Enter()

    Me.AllowEdits = True

End Sub

Private Sub SearchField_Exit(Cancel As Integer)

    Me.AllowEdits = False

End Sub

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful