none
Form Allow Additions doesn't work RRS feed

  • Question

  • Hi all,

    Access 2007 & 2010

    I have a form that I open with:

    DoCmd.OpenForm nFORMO, , , , acFormEdit, acWindowNormal

    The properties are like this:

    the Record Source of this form is one table plain simple...

    Has some textbox controls each one bound to a field from the table

    The table has just one record.

    When I press enter in the last textbox (Tab order) all the textbox became empty like they are ready to get more data in a new record.

    And if type anything in one of the textbox i get a new unwanted recod in the table.

    How can I avoid the behavoir ?

    Best regards


    Joao Simplicio Rodrigues

    Friday, January 26, 2018 5:16 PM

All replies

  • Have you tried setting the form's Cycle property to Current Record?

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Friday, January 26, 2018 6:25 PM
  • By specifying acFormEdit, you overrode the property settings of the, as described in the help topic https://msdn.microsoft.com/en-us/VBA/access-vba/articles/acformopendatamode-enumeration-access .

    Name Value Description
    acFormAdd 0 The user can add new records but can't edit existing records.
    acFormEdit 1 The user can edit existing records and add new records.
    acFormPropertySettings -1 The user can only change the form's properties.
    acFormReadOnly 2 The user can only view records.

    Either don't specify that OpenForm argument at all, or specify acFormPropertySettings.  Note: the description above of the effect of acFormPropertySettings is incorrect.  acFormPropertySettings actually means, "follow the Allow... property settings of the form."


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html



    Friday, January 26, 2018 7:01 PM
  • Hi João Simplicio Rodrigues,

    I can see that you had used 'acFormEdit' in your code and if we see the form properties you set 'Allow Additions' to false.

    Do you mean when you open the form , you just want to display that one record from the table and want to edit it?

    Then you can try to create unbound form and fetch that one record when you open the form and display it to user.

    Place one button, To modify that one record that fire an update query from the code on that button click event.

    By this way, You will be able to display one record and modify that single record without adding any new record.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 29, 2018 2:36 AM
    Moderator
  • Thank you all for your replies.

    Unfortunately days just have 24 hours and I couldnt get the opportunity to adress this question and try yours sugestions

    Joao


    Joao Simplicio Rodrigues

    Wednesday, February 28, 2018 1:38 PM
  • Hi João Simplicio Rodrigues,

    When you get a free time, you can make a test of the suggestions and let us know about the result.

    We will try to provide you further help to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 8, 2018 8:41 AM
    Moderator