Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2008
    Posts
    3

    Unanswered: Want to disallow record deletion in subform

    Hello

    I have used a subform to display records in a datasheet view based on certain search criteria on the main form.
    My problem is that I am able to delete a record / all records simply by using the right click menu in the sub form.
    I dont want the users to have the ability to add/edit/delete records.

    Please help.

    Thanks!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Set the subform's AllowDeletions property to No.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jul 2008
    Posts
    3
    Thanks StarTrekker

    I have set the AllowDeletion property to No in the Design View. Despite that it allows records to be deleted.
    Do I need to set it programatically during runtime too?

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    The only explanations for that are that code somewhere is turning it back on or you've set it for the wrong form. Do a search in your code for AllowDeletions and see if it's being set on again.

    You can also confirm what the setting is by putting a MsgBox Me.AllowDeletions into the OnClick event of something easy, maybe the form's background. Then you can check the property at runtime to see if it's set correctly.

    One more thing... the right click menu you are talking about... is it a standard shortcut menu or a custom one? If it's a custom one it might do the deleting via VBA and a refresh. AllowDeletions wont stop that.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jul 2008
    Posts
    3
    You were right...I was turning the AllowDeletion flag on in the code. I have been able to rectify my situation.

    Thanks a heap!

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're most welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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