A question about queries and forms

T

The Iconoclast

Greetings!
I have a form (datasheet view) that is populated by a query:
1. Would it be possible to disable all of the records except for the new
records that are to be added. or
2. Would it be possible to disable (make uneditable) certain fields of
existing records?

Thanks
 
A

Allen Browne

To prevent any edits but allow new entries, set the form's Allow Edits
propety to No, while leaving the Allow Addtions property as Yes.

To prevent edits to particular controls, set their Locked property to Yes.

If you need to do both in combination, use code in the Current event of the
form to set the Locked property of the controls, depending on the NewRecord
property of the form, e.g.:

Private Sub Form_BeforeUpdate
Dim bLock As Boolean
bLock = Not Me.NewRecord
Me.SomeControl.Locked = bLock
Me.AnotherControl.Locked = bLock
...
End Sub
 
Top