Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prevent Changes (2000 SR-1)

    I want to change a field (a spin box) and once data has been entered in that field, prevent it from being changed.

    Is this possible? If so, how do I do it?

    Thanks for any help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Prevent Changes (2000 SR-1)

    If the control is bound to a field in the record source of the form, you can use the On Current event of the form to check if it has a value, and lock it if so:

    Private Sub Form_Current()
    Me.ControlName.Locked = Not IsNull(Me.ControlName)
    End Sub

    where ControlName must be replaced with the name of your control. You could also lock the control in the AfterUpdate event of the control itself, but that means that the user can't correct mistakes after entering a value for the first time. So I prefer to let the control remain unlocked until the user moves to another record.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prevent Changes (2000 SR-1)

    Hans,

    Thanks for your solution and for posting it so quickly.

    Tell Woody I reckon you deserve a raise!

    Regards,

    TedOz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •