Results 1 to 5 of 5
  1. #1
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67

    input to textbox if the form is readonly

    I've made my form readonly based upon which user opens this form. I have a textbox which I'd like to make either enabled and/or unlocked for a user to enter their search criteria. I've tried me!textbox.enabled = TRUE, as well as
    me!textbox.locked=FALSE, but neither or both methods are not allowing me to key into this textbox. Is the readonly overriding the enable and lock controls? Is there a different datamode that will allow a user to key into a textbox while the entire form is locked?

    Does this method work? Or instead of ctl.Value, could it be ctl.enable or ctl.lock. If yes, what datamode need to be?

    For Each ctl In Me.Controls


    If ctl.ControlType = me!textbox Then
    If ctl.Value <> False Then
    ctl.Value = False
    End If
    End If
    Next ctl

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    look at the Similar Threads at the bottom of the page (scroll down) for ideas.
    There is often info to help resolve an issue.

    This one may be helpful.

    From another reference:

    Enabled = No means it is grayed out and unavailable to click in at all.

    Locked = Yes means you can't change the data but you can click in it and do a copy of the data.

    Setting Enabled = NO and Locked = YES means that it is not grayed out and you can not click in the control nor can you highlight and copy.

  3. #3
    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
    As I explained in Post #7 of the thread orange gave you a link to, you need to make the Form updatable, again, 'mark' the one Control you want to be usable, then loop through all Controls and Lock all those not 'marked.'

    That post gives you this approach in more detail.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67
    What does .tag represent in this illustration? When I added this code, all of my textboxes were locked. The name of my textbox is SearchFor wich would be the only one that I don't need to be locked

    Dim ctrl As Control

    For Each ctrl In Me.Controls
    If (TypeOf ctrl Is TextBox) Or (TypeOf ctrl Is CheckBox) Or (TypeOf ctrl Is ComboBox) Then
    If ctrl.Tag <> "DoNotLock" Then
    ctrl.Locked = True
    End If
    End If
    Next

  5. #5
    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
    Tag is a Property of a Control. From the post you found the above code at:

    In Design View, select the Control you want to be functioning and go to Properties-Other and in the Tag Property box enter DoNotLock, just like that, no quotes.
    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 5
    Last Post: 09-12-2017, 12:41 AM
  2. Replies: 13
    Last Post: 05-09-2016, 12:33 PM
  3. Input Value based on another textbox value
    By dude19 in forum Access
    Replies: 2
    Last Post: 06-30-2011, 03:48 PM
  4. Replies: 9
    Last Post: 04-04-2011, 11:13 AM
  5. Textbox will not allow input
    By cwf in forum Forms
    Replies: 0
    Last Post: 04-04-2008, 04:08 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