Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Posts
    10

    Unanswered: unlock controls when going to new record

    Hi I'm locking controls on a form once the user has made a choice but I want to be able to unlock them when they move to a new record. Can I use the on current event or is that whatever record is being used now? which wouldn't be what I want.

    TIA

    B

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi bobnz

    I think you an pick the bounes out of the following to do what you want!

    Code:
    Private Sub Form_Current()
        If Me.NewRecord Then
            MsgBox "This is a new record, therefore unlock controls."
        Else
            MsgBox "This is an existing record, therefore lock the controls."
        End If
    End Sub
    You may have to re-lock the controls in the after update event, if the on currnt event does not fire on saving the new record (I cann't remember of hand?), but if you just most off the new record then the on current will re-lock them for you.

    THT

    MTB

  3. #3
    Join Date
    Sep 2003
    Posts
    228
    Quote Originally Posted by bobnz
    Hi I'm locking controls on a form once the user has made a choice but I want to be able to unlock them when they move to a new record. Can I use the on current event or is that whatever record is being used now? which wouldn't be what I want.

    TIA

    B
    Did you mean when they move to a new record or when they change records from the one the user is currently on?

    There is a big difference between the two and I can't really decide what you meant by "new". The current event is called each time you move to another record. Like mike said, you can check for .new inside the current event to see if the the record moved to will be a new record inserted into your table.

  4. #4
    Join Date
    Aug 2002
    Posts
    10
    Thanks for the replies,
    New as in when the user creates a new record.
    when the user clicks an order button then that row of the record is locked when they create a new record those controls have to be unlocked.
    I think what Mike gave will do the trick, will try and let you know.

    B

Posting Permissions

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