Results 1 to 6 of 6
  1. #1
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    215

    All Textboxes Read-Only on Form

    I want to have all of my textboxes and other fields in my form as read-only, but not greyed out, until a button is clicked, for example "Edit." What would be the best approach to doing this? Conditional Formatting? VBA?



    Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'd probably set the AllowEdits property of the form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    215
    I am looking into this as a possible way to prevent unintentional changes to data. I would like certain forms to be ready-only and then when the "Edit" button is clicked have a pop up window come up verifying that you want to make changes and then when yes is clicked, make all fields on the form editable. Would I have to apply the AllowEdits to each object in the form or would I be able to apply to all with VBA?

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by cbrsix View Post

    ...Would I have to apply the AllowEdits to each object in the form or would I be able to apply to all with VBA...
    This is all you need:

    Code:
    Private Sub Form_Current()
     Me.AllowEdits = False
    End Sub
    Code:
    Private Sub EditButton_Click()
     
     Dim resp As Integer
     
     resp = MsgBox("Would You Like to Edit This Record?", vbYesNo + vbDefaultButton2)
     
     If resp = vbYes Then Me.AllowEdits = True
     
    
    End Sub

    Moving to the next Record will lock the Form again.

    Linq ;0)>

  5. #5
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    215
    Thank you. That works perfectly.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 12-04-2012, 02:50 PM
  2. Just numeric input for all textboxes in the form
    By amd711 in forum Programming
    Replies: 7
    Last Post: 11-27-2012, 08:08 AM
  3. Replies: 5
    Last Post: 08-28-2012, 03:23 PM
  4. Form - CANNOT EDIT TEXTBOXES !!!
    By dbalilti in forum Access
    Replies: 5
    Last Post: 07-05-2012, 12:15 PM
  5. Replies: 2
    Last Post: 10-19-2006, 04:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums