Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Allow Edits (Access 2000)

    In my subform on the OnCurrent event i have a code that disallows editing:

    Me.AllowEdits = Me.NewRecord
    This code is perfect, since the user is not alowed to edit records already chosen.
    I want to make an exception however, and that is when i want to allow changing the price.
    In that case i want to allow the user change the price, and then again revert to the old situation when editing is not allowed
    with new records.
    However simply writing Me.AllowEdits = True does not help.
    I must somehow make invalid the line
    Me.AllowEdits= Me.NewRecord

    So my question is can i both keep my code in my OnCurrentEvent and also make it false for a given event?
    I have a special button called "PriceChange" where on clicking it i want to give this possibility.

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

    Re: Allow Edits (Access 2000)

    Set Me.AllowEdits = True in the On Click event of the command button. This will allow the user to edit one record, he.she will have to click the button again in another record in order to edit it.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Allow Edits (Access 2000)

    Thank you for your nice reply and the wonderful and detail explanation

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

    Re: Allow Edits (Access 2000)

    If you want the records to remain editable as the user moves from record to record, use a toggle button instead of a command button. Say that you name it tglPriceChange. The code in the On Click event of the toggle button would be:

    Private Sub tglPriceChange_Click()
    Me.AllowEdits = Me.tglPriceChange
    End Sub

    and the code in the On Current event of the form must be changed to

    Private Sub Form_Current()
    If Me.NewRecord Then
    Me.tglPriceChange = True
    Me.AllowEdits = True
    Else
    Me.AllowEdits = Me.tglPriceChange
    End If
    End Sub

Posting Permissions

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