Back

Tip 15. Only Allow Users to Edit New Key Columns.

It is sometimes desireable the stop users editing key columns once they have created them. This can be done easily using datawindow column expressions.

Add this expression into the background colour expression for the key column. It changes the colour of the column to either Windows Background or the background of the datawindow. This is to show that the column is no longer editable.

if ( IsRowNew(), 1090519039, Long(Describe("Datawindow.Color")))

Add this expression into the protect expression for the key column.

if ( isRowNew(), 0, 1)

If you use query mode then use these expressions.

Background Colour

if ( Describe("Datawindow.QueryMode") = "yes" or isRowNew(),
1090519039, Long(Describe("Datawindow.Color")))

Protect

if ( Describe("Datawindow.QueryMode") = "yes" or isRowNew(), 0, 1)

Added before 01 Jan 2000

Back