• Change form mode (Access 2003)

    Author
    Topic
    #424325

    I have a form that is opened with this line of code:
    DoCmd.OpenForm strDocName, acNormal, , , acFormReadOnly
    When I push a button on the form, I would like to be able to edit the form. Like open it in add mode.
    Thanks,
    Nick

    Viewing 0 reply threads
    Author
    Replies
    • #974113

      To allow the user to edit existing records, put the line

      Me.AllowEdits = True

      in the On Click code of the command button. To allow the user to create new records:

      Me.AllowAdditions = True

      and to allow the user to delete existing records:

      Me.AllowDeletions = True

      You can use any combination of these.

      • #974122

        When i put those lines of code in and then select the button, the form still is in read only mode. any other thoughts

        • #974124

          I’ve tested it, and it works. Check carefully that you have put the code in the correct event procedure.

          • #974127

            I will check, if i still have problems, I will post a version of the database.
            Thanks

          • #974130

            Here is my code. For some reason on the striped down version, the form isnt opening in read only mode? Help please!

            • #974136

              The code in the On Load event of frmMain (which was requested by you) changes the value of a control. This takes the form out of read-only mode. You’ll have to choose: either open the form read-only and forego setting the value of Activity Code, or open the form in editable mode and set Activity Code.

    Viewing 0 reply threads
    Reply To: Change form mode (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: