Results 1 to 3 of 3
  1. #1
    skpanuganti is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    2

    How to Lock Texboxes based on another Textbox value in a form

    Hi All -

    In the form all texboxes(values) are populated based on the selection of a value from a combo box.Say for example, the combo box has values from 1 to 100 & there are few Textboxes txt1,txt2,txt3,txt4,txt5. The possible values for txt1 are X1,X2,Y1&Y2. i.e., whatever we select from a combo, txt1 value should be from one of those four values. Now my question is, how to lock other textboxes txt2,txt3,txt4 if txt1 value is either X1/X2 else unlock.



    Many Thanks in Advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try in the AfterUpdate event of combobox something like:

    Dim booVar As Boolean
    booVar = (Me.txt1 = "X1" Or Me.txt1 = "X2")
    Me.txt2.Locked = booVar
    Me.txt3.Locked = booVar
    Me.txt4.Locked = booVar
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    skpanuganti is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    2
    Thanks June, its working. But i did a small change, instead of "AfterUpdate" event i inserted the code in "OnChange" event.

    Thank you so much.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-26-2012, 11:57 AM
  2. Input Value based on another textbox value
    By dude19 in forum Access
    Replies: 2
    Last Post: 06-30-2011, 03:48 PM
  3. Replies: 2
    Last Post: 09-17-2010, 09:53 AM
  4. Replies: 3
    Last Post: 02-10-2010, 07:29 AM
  5. trying to add color to texboxes
    By michaelpclisbee in forum Forms
    Replies: 2
    Last Post: 07-04-2009, 02:45 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