Permission & Access Issues

How to Make an Access Record Read-Only When Status is Paid

Aamir Naveed AkramAamir Naveed Akram Nov 4, 2026 868 views

Question details

The user wants to prevent edits to a Microsoft Access form and its associated order-item subform when the OrderStatus field indicates the order has been 'Paid'.

How to Make an Access Record Read-Only When Status is Paid
Product
Microsoft Access
Device & OS
not provided
Scenario
Managing order records where completed or paid orders must be locked dynamically to prevent accidental data modification.
Observed behavior
Applying locking logic to both the main form and the subform causes conflicting code and 'Method or Data member not found' errors, failing to properly secure the record.
Before you start

Before modifying your VBA code, open your form in Design View and verify the exact Name property of your status control in the Property Sheet, as this name must match the one referenced in your VBA script.

Solution 1Recommended

Apply VBA Logic to the Main Form's On Current Event

The most reliable way to lock a record based on a field's value is to evaluate the condition exclusively in the main form's On Current event.

Applying read-only logic directly to both the main form and its subform often causes conflicts or triggers a 'Method or Data member not found' error. Placing the AllowEdits logic exclusively in the main form properly controls the read-only state for both.

1
Open Main Form in Design View

Navigate to the Navigation Pane in Access, right-click your main Order form, and select 'Design View'.

2
Access the On Current Event

Ensure the form itself is selected. Open the Property Sheet, go to the 'Event' tab, find the 'On Current' event, click the ellipsis (...) button, and choose 'Code Builder'.

3
Insert the Locking VBA Code

In the VBA editor, type the following code between Private Sub Form_Current() and End Sub: If Me.OrderStatus.Value = "Paid" Then Me.AllowEdits = False Else Me.AllowEdits = True

4
Save and Test the Form

Save your VBA module, switch the form back to 'Form View', and navigate through your records to verify that forms marked as 'Paid' are uneditable.

Apply VBA Logic to the Main Form's On Current Event
Verify Control Names: Ensure that 'OrderStatus' in the VBA code exactly matches the Name property of the form control, which may differ from the underlying table field name.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite? Try WPS Office

While Microsoft Access is a powerful specialized database tool, handling your daily documents, spreadsheets, and presentations doesn't require a heavy or expensive Office suite. WPS Office offers a free, lightweight alternative for your Word, Excel, and PowerPoint files with a highly familiar interface.

Seamlessly open, edit, and save Microsoft Word, Excel, and PowerPoint file formats with perfect compatibility.Lightweight installation that runs smoothly on almost any device without consuming massive system resources.Familiar user interface ensuring a zero-learning-curve migration from Microsoft Office.Built-in PDF editor allowing you to easily view, edit, and convert documents to and from PDF.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a 'Method or Data member not found' error in my Access VBA?

This error generally occurs when your VBA code references a control name that does not exist on the currently active form. Check your Property Sheet to ensure your code uses the control's exact 'Name' property, which is sometimes different from the table's field name.

Does setting AllowEdits to False on the main form automatically lock the subform?

Yes, in most configurations, when you lock the main form by setting Me.AllowEdits = False, Microsoft Access restricts edits to the data in both the main form and any natively bound subforms.

How can I allow users to add new records while keeping 'Paid' records read-only?

You can use Me.AllowAdditions = True in your VBA script alongside your AllowEdits logic. To prevent locking up a blank new record, check the Me.NewRecord property first, allowing edits if the record is completely new.

What if my status field is a combo box looking up values?

If the status field is a combo box, you must evaluate its bound column. If the bound column stores a numeric ID instead of the text string 'Paid' (for example, 2), your VBA condition needs to check for that specific ID: If Me.OrderStatus.Value = 2 Then.