Results 1 to 15 of 15
  1. #1
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338

    Text box change color




    Hello

    I have two check boxes on a form. I would like to force the user to pick one of the check boxes. Once the user picks the check box, it would change the color for some of the text box and required them to only fill in those text box that change color.

    Thank you,

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Are these checkboxes each bound to a field? If only one check is allowed then this should be one field. Use radio buttons in an OptionGroup control and only one can be selected. Bind the OptionGroup control to the field.

    Use Conditional Formatting to control backcolor of the textboxes.

    Is this form in Single view? Instead of just changing color, could use code to disable or make invisible textboxes that should not be used.
    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
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    June7

    I like your idea making textboxes invisible. It is a single form view. Can you guide me how to do this????


    Thank You

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    In checkbox click event, VBA code something like:

    Me.textboxname.Visible = Me.checkboxname
    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.

  5. #5
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Which event should i pick???

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Wait, are you still using two checkboxes or did you change to a single field and one checkbox or radio buttons in option group?
    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.

  7. #7
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I'm using two checkboxes

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    So can both checkboxes be checked at the same time? Why two checkboxes? Each checkbox will manage different controls?

    As suggested earlier (post 4), try the checkbox click event.
    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.

  9. #9
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Both checkboxes can not be checked off at the same time. Some textbox would be need for both check box. Example patient name would be needed for both.

  10. #10
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I forgot to mention that i also have a subform.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    What prevents user from checking both checkboxes?

    The checkboxes are on main form and controls to be managed are in subform?
    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.

  12. #12
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Check box one is Check and check box two is credit card. So for each check box the user would enter different inforamion. Some of the controls are on the main form and some on the subform.

    Table One:Patient Demographics (Form One)
    Table Two: Refund Request (Form Two)

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Still don't know what prevents user from checking both checkboxes. Still seems to me should be one field bound to option group holding 2 radio buttons.

    I always give subform container control a name different from the object it holds, like ctrDetails. Then reference to subform controls like:

    Me.ctrDetails.Form.controlname1.Visible = Me.checkboxname
    Me.ctrDetails.Form.controlname2.Visible = Not Me.checkbaxname
    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.

  14. #14
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Can i put something to prevent user from checking both checkboxes. Lets go with radio buttons. On post 2 you suggested to use radio buttons but i'm not sure how to go about this.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Can i put something to prevent user from checking both checkboxes.
    That would be complicated, maybe impossible.

    If you use option group and radio buttons (AKA Option Buttons, need one field instead of 2, review http://office.microsoft.com/en-us/ac...005188325.aspx

    Checkboxes and toggle buttons can also be in option group but radio button makes most sense to me.
    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.

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

Similar Threads

  1. Change color on text using column value?
    By PoorCadaver in forum Programming
    Replies: 5
    Last Post: 03-02-2012, 09:52 AM
  2. Replies: 1
    Last Post: 12-14-2010, 10:03 PM
  3. Using an event to change color of text.
    By michaeljohnh in forum Programming
    Replies: 3
    Last Post: 08-30-2010, 12:30 PM
  4. Replies: 3
    Last Post: 07-05-2010, 10:46 PM
  5. Change the text box color on form load
    By mikec in forum Programming
    Replies: 2
    Last Post: 03-01-2010, 11:47 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