Continuous Forms Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slenish
    Contributor
    • Feb 2010
    • 283

    Continuous Forms Problem

    Hello,

    I having some problems with a form where I have it set to Continuous Forms. I have a text box that I want to turn Red when a condition is met but when the condition is true it turns all of the text boxes red and not just the one on the current form I have focus on.

    Is there any way to do with this VBA? I have created the condition in VBA just cant figure out the form part.

    Appreciate any help!

    Thanks
    Slen

    Working in Access 2007

    Here is the code for the conditional expression
    Code:
    Dim objFrc As FormatCondition
    
    
    Me![txtBox].FormatConditions.Delete
    
    Set objFrc = Me.Record_Number.FormatConditions.Add(acExpression, acEqual, Me.CheckBox.Value = True)
    
    Select Case CheckBox.Value
    Case True
    With Me![txtBox].FormatConditions(0)
                    .BackColor = vbRed
                End With
                
    End Select
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32653

    #2
    Please see Why Values in Unbound Form Controls do not Persist. If your control is bound, you may find Conditional Formatting worth checking out though.

    Comment

    • slenish
      Contributor
      • Feb 2010
      • 283

      #3
      Hi NeoPa,

      Been a while..how have you been?

      The form im currently using is a bound form unlike my usual MO of unbound. Im using continuous forms so I found using a bound form to be better suited for this.

      Is there any way to use Conditional Formating with the bound form and keep the focus on the current form? If I set the condition of a text box by using the user friendly way and just clicking on the conditions button and then set the condition. But im trying to do it with VBA. Any ideas?

      Thanks :D

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32653

        #4
        Hi Slenish. I'm good thanks. You too I hope.

        The fundamental point is that there is only the one control, no matter how many instances of this you see on the form. I think that means that any VBA code would be pointless. You can only configure the control one way. What would be the point of changing it while it's running. Any definition could more easily be done at design time.

        Comment

        • slenish
          Contributor
          • Feb 2010
          • 283

          #5
          Hi NeoPa. Im doing good as well.

          Guess if i cant do it with VBA thats alright I can always do it the other way with the conditions button. Just thought I would challenge myself :D

          Appreciate the help my friend.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32653

            #6
            Always welcome :-)

            NB. It's not exactly that VBA cannot set the control up to do the conditional formatting, it's more that there would be no point when you can include it in the design (as there is no point during the running of the code where it would be appropriate to change the configuration).

            Comment

            Working...