Search code examples
ms-accesseditcustom-fieldsrecords

Is it possible to add records into Ms Access Form, while some fields are locked?


In my Ms Access form - I have a few locked fields. So, that users won't be able to change existing information. But they might still needed to add a new records into the Form.

Is it possible to be able to add a new records, without changing or removing an existing ones?

Thanks, as always!


Solution

  • Define an On Current event on form level. Like

    Private Sub Form_Current()
    
    If Me.NewRecord Then
    Me.txtField1.Enabled = True
    Me.txtField2.Enabled = True
    
    Else
    Me.txtField1.Enabled = False
    Me.txtField2.Enabled = False
    
    End If
    
    End Sub
    

    Replace txtField1 and txtField2 with the names of your form fields.