Quick Find: Search for:
Free Resources
from FMS
 

Demos

Email Newsletter

Technical Papers

Tips and Techniques

Links

Book Recommendations

View all FMS products for Microsoft AccessMicrosoft Access Resource Center

 

 

"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.
" 
- Darren D.
 
  

 

Enabling or Disabling Controls on a New Record

Provided by: Steve Clark, Senior Project Manager

Sometimes on a form there are functions that 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
      cmdStuff.Enabled = True
      Else
      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()
      cmdStuff.Enabled = me.newrecord
      End Sub

 

Return to the tips page.

Questions  l   Web questions: Webmaster   l   Copyright © 2008 FMS, Inc.

Celebrating 21 Years of Software Excellence