Allow additions but disable already entered data

  • Thread starter Thread starter Chris Finke
  • Start date Start date
C

Chris Finke

How can I disable some of the fields in an Access form so that they
are not accidentally edited, but still allow new records to be created
through the form? As of now, only the non-disabled fields can be
added.
 
Use the Current event of the form, to set the Enabled properties of the
controls, based on whether it is a new record:

Private Sub Form_Current()
Dim bAllow As Boolean

bAllow = Me.NewRecord

Me.SomeField.Enabled = bAllow
Me.AnotherField.Enabled = bAllow
'etc.
End Sub
 
Allen Browne said:
in message


Use the Current event of the form, to set the Enabled properties of the
controls, based on whether it is a new record:

Private Sub Form_Current()
Dim bAllow As Boolean

bAllow = Me.NewRecord

Me.SomeField.Enabled = bAllow
Me.AnotherField.Enabled = bAllow
'etc.
End Sub

Thanks; this worked perfectly, although I chose to change it to

Me.SomeField.Locked = Not bAllow

so that the fields would not be grayed out, and thus, easier to read.

For anyone who reads this in the future for reference, I'm using
Access 2000 connecting to an MSSQL 2000 server.
 
Back
Top