Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change form mode (Access 2003)

    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

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

    Re: Change form mode (Access 2003)

    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.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change form mode (Access 2003)

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

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

    Re: Change form mode (Access 2003)

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

  5. #5
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change form mode (Access 2003)

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

  6. #6
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change form mode (Access 2003)

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

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

    Re: Change form mode (Access 2003)

    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.

Posting Permissions

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