Sometimes on a Microsoft Access form there are features you would like to allow the user to perform, but only if the data is for a new record.
For example, there may be a button that should only be clicked for new data. An easy way to enable and disable the button is to use the Me.NewRecord property inside of the form's On Current event property:
The following example shows one way to write the code:
Private Sub Form_Current() If Me.NewRecord = True then Me.cmdStuff.Enabled = True Else Me.cmdStuff.Enabled = False End if End Sub
And here is the bulk of that code reduced to a single line of code!
Private Sub Form_Current() Me.cmdStuff.Enabled = Me.NewRecord End Sub
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.