I'm trying to add logic to my VB code to not allow changing of a field (for
example, an existing order number). I added logic in VB code of the Before
Update event, that if something exists in that field already, the VB code
displays a message saying it can't be changed, and I saved the original value
of what was in their before they edited it, but I can't figure out how to put
that original value back in. Only on new orders should the user be able to
enter a value in the field. For existing orders, the order number should be
not editable.
Cyberwolf - 24 May 2006 20:28 GMT
I would code the on current event so the field can't be edited if there is an
existing value. ie.
if me.fieldname is not null then
fieldname.locked = true
else
fieldname.locked = false
THis is untested and may need to be tweaked.
end if

Signature
James Gaylord
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf
> I'm trying to add logic to my VB code to not allow changing of a field (for
> example, an existing order number). I added logic in VB code of the Before
[quoted text clipped - 4 lines]
> enter a value in the field. For existing orders, the order number should be
> not editable.
Larry Daugherty - 24 May 2006 21:46 GMT
One way that will get the job done is to set the control's Enabled
property Off. Then, in the form's OnCurrent event, test the control's
value for null. If it is null then MyControl.enabled = True. Else
MyControl.enabled=False
Once the record is saved with a non-null value the control will be
disabled.
You may want to make that one control Bold so the number is still easy
to read.
HTH

Signature
-Larry-
--
> I'm trying to add logic to my VB code to not allow changing of a field (for
> example, an existing order number). I added logic in VB code of the Before
[quoted text clipped - 4 lines]
> enter a value in the field. For existing orders, the order number should be
> not editable.