Poppy,
the following works for me in my inventory database (and keeps the users from accidentally stepping on an ItemNum with ".." search attempts while in 'update' mode). It allows the ItemNum to be written to if in Add or Search mode, but not in Update mode:
ItemNum:

nElementEntry ...
If (@mode() = 1) AND (@IsBlank(ItemNum) = 0) and (FixOKd <> 1)
{
ReadOnly(ItemNum,2)
}
I also have code to make ItemNum writable for modes ItemNum:

nFormReveal, OnFormChanges, OnFormEntry, and Inventory::Retrieve Spec Open with the following code:
If @Mode() = 2
{
ReadOnly(ItemNum, 0)
}
My users do not have access to the side panel, and must utilize on form command buttons (preferable) or function keys (old habits). I try to have my users save a changed record by having to use a command button to save (instead of F10, which I disable temporarily with the following code), as I have other housekeeping that is checked/updated when a record is changed in Inventory.
Inventory:

nFormEntry
If (@Mode() = 0) and @IsNew
{
IgnoreKey(KEYCODE_F10, 0)
}
If @Mode() = 1
{
IgnoreKey(KEYCODE_F10, 0)
NotifyForm(7)
}
If @Mode() = 2
{
ReadOnly(ItemNum, 0)
ClearIgnoreKey(KEYCODE_F10)
}
and on Inventory:

nFormExit and Inventory::RetrieveSpecOpen
ClearIgnoreKey(KEYCODE_F10)
Hope I'm not steering you wrong. The above arrangement works for my users beautifully.
ps (I have a 'fix' command button that allows ItemNum to become writable in update mode in the event I need to change something in the ItemNum or ItemCategory designation).