Conditional formatting on a conditional form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LizaHawkins
    New Member
    • Dec 2009
    • 7

    Conditional formatting on a conditional form

    I have a drop down box on a continuous form called (cmbItem)
    When the users choose Option 6 (Other)or on the open event I wish to show another field txtOther which allows the user to give a description of what 'other' means but I only want to show the field for that record. (the user could potentially have more than one record as other)
    Using conditional formatting I have managed to change the colours of the box so that the background is the same colour as the form unless other is chosen when it reverts to white. However I can't do the same with the border as this is not one of the options provided.
    I need to use VBA but I am struggling to use the formatcondtions .add
    Any help would be very appreciated.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi Liza

    Would it not be better just to change the Visible property of txtOther using the AfterUpdate event of cmbItem, depending on what is selected in cmbItem ?


    MTB

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1288

      #3
      Liza,
      You have a few choices. One is to not use any border for the field. You'll find that option in the properties for the text box under Format. But most folks would simply make it visible or invisible whenever the combo box changes.

      Add handling for event AfterUpdate of the combobox cmbItem. Then simply add this if/then block to the routine:
      Code:
      if cmbItem="Other" then
          me.txtOther.visible = true
      else
          me.txtOther.visible=false
      endif
      You can choose to set the initial visible property at startup in the OnOpen event or in the properties of the object.

      Jim
      Jim
      Last edited by jimatqsi; Apr 7 '14, 11:21 AM. Reason: add tag for code

      Comment

      • LizaHawkins
        New Member
        • Dec 2009
        • 7

        #4
        On a continuous form if I use this code it shows the text box to describe what other means for every line which doesn't look very nice.

        Comment

        • jimatqsi
          Moderator Top Contributor
          • Oct 2006
          • 1288

          #5
          Oh, yes... if you are doing this in the detail of a continuous form, and you use an unbound object, you will see the same result for all detail lines at any one time. Best to put the unbound object in the header and make it clear it reflect the current line only.

          Jim

          Comment

          • jimatqsi
            Moderator Top Contributor
            • Oct 2006
            • 1288

            #6
            That still leaves the option of the no-border solution.

            Comment

            • LizaHawkins
              New Member
              • Dec 2009
              • 7

              #7
              The problem is, there may be multi records where the user has chosen other and they want to be able to see all of the descriptions next to the record, so I can't put it in the header. I am sure I need to use add.formatcondt ions but despite looking on the web at some examples I havent been successful I am not sure if this is because I am using Access 2010, things seem to change a bit in access 2013.

              Comment

              • jimatqsi
                Moderator Top Contributor
                • Oct 2006
                • 1288

                #8
                Eliminating the border doesn't solve the problem?

                Comment

                • LizaHawkins
                  New Member
                  • Dec 2009
                  • 7

                  #9
                  Yes, thats what I have now, but the background is cream and the text box is white so its very difficult to see.
                  Everywhere else there are boarders round text boxes I want the users to update so it just looks like I forgot this bit. Its a fudge and it will do, I just wanted to see if anyone could help me use the add.formatcondi tion. The final product will look more professional and I will learn something new which is always a bonus.

                  Comment

                  Working...