Search code examples
ms-accessvbams-access-2016

Access: Fill in data (date) from another when entered and empty


Working with MS Access 2016. I have a form with multiple textboxes. I want one of my textboxes (tbx_outTSDatum_BQC) to be automatically filled -if entered and empty- with the value of another textbox (tbx_inTSDatum_BQC). This code does nothing:

Private Sub tbx_outTSDatum_BQC_Enter()
    If Me.tbx_outTSDatum_BQC.Value = Empty Then Me.tbx_outTSDatum_BQC.Value = Me.tbx_inTSDatum_BQC.Value
End Sub

Changing the event from Enter() to GotFocus() does not help. How can I get this working? Thank you.


Solution

  • It is Null to check for:

    If IsNull(Me!tbx_outTSDatum_BQC.Value) Then 
        Me!tbx_outTSDatum_BQC.Value = Me!tbx_inTSDatum_BQC.Value
    End If