Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Subform doesn't allow record additions (Access XP)

    Hi,
    I created an orders form similar to the one in the Northwind database. The form shows order details on the main form and products in the subform. Then I open the properties of the main form and select NO for the Allow Edits command. When I go to a new record, I can add a new order, but the subform disallows any records???...in fact it does not even show a blank new record to add to!!!

    I tried this in the Northwind database too...and the same thing happens??

    What is my error...all i want is that nobody can edit data after the record is written to the DB, but now I cannot add a new order? Any explanation and solution?

    Tx
    Regards,
    Rudi

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform doesn't allow record additions (Access XP)

    Rudi

    Difficult to know what exactly it is ...can we have a cut down version?

    A quick one off the top of my head from the info you gave is change Allow Edits to Yes and now see what happens.
    Jerry

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform doesn't allow record additions (Access XP)

    Actually I do not need to cut down anything. If you open the Northwind DB and open the orders form, swing it to design and change the Allow Edits to No, and then swing it back to form view and go to a new record, you will see that the products subform does not allow you to add data.??????????????

    I actually want the Allow Edits to be No so noone can edit existing data, but I DO want them to add new orders. I'm wondering if this is a flaw, or is it some conflict issue that I am not thinking of!??
    Regards,
    Rudi

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

    Re: Subform doesn't allow record additions (Access XP)

    By default, a subform will be locked for edits, additions and deletions if the main form has Allow Edits = No. You can set the AllowAdditions property of the subform to True in code:

    Me.[Subform Orders].Form.AllowAdditions = True

    and similar for the AllowEdits and AllowDeletions properties.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform doesn't allow record additions (Access XP)

    Hi Rudi

    I see now. By clicking on No for Allow Edits on the Mother form, the subform inherits it as well.

    I would suggest that you rethink your design. You could set the properties on each control on the main form to be Locked, that way they cannot change the details and then have Allow Edits as Yes and that will allow additions and deletions from the subform.
    Jerry

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform doesn't allow record additions (Access XP)

    Tx Hans.

    I tested your theory on the Northwind database and added the code: Me.Orders_Subform.Form.AllowAdditions = True to the OnCurrent event of the Orders form...and it works like a charm!

    Cheers
    Regards,
    Rudi

  7. #7
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform doesn't allow record additions (Access XP)

    Tx...Han's advice has solved it nicely.

    PS: I would not be able to lock the controls on the mail form as this will not allow me to add a new order. Anyways...it seems the GUI interface approach lacks the power that VBA has to control the form.

    Cheers
    Regards,
    Rudi

Posting Permissions

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