Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: Access Forms FAQ

Form Basics

Edit Button by Kherozen
Posted: 20 Jun 03

Something it's useful to have a form serving as a viewer so data can't be add and/or edit and be able to change it as a editor on a click of a button

Here's the way I do it :

The Forms and subforms properties is set to
       .AllowAdditions = false
       .AllowEdits = False

then create a button that will contain the following code in the On Open events

    Me.AllowAdditions = True
    Me.AllowEdits = True
    'if there's no subform don't include the rest of the code
    For Each myControl In Controls
        Select Case myControl.ControlType
            Case acSubform
                myControl.Form.AllowAdditions = True
                myControl.Form.AllowEdits = True
        End Select

The advantage of my code is that you don't need to enter the form/subforms name and you can add/remove subforms within the form without having to change that part of the code...code it and forget it!(just like the chicken in the ads).

there's surely some bad points to my code but like a good politician, I won't mention them

       jul ^_^
"Computer Science is no more about computers than astronomy is about telescopes"
E. W. Dijkstra.

Back to Microsoft: Access Forms FAQ Index
Back to Microsoft: Access Forms Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close