VBA Function Assistance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • csolomon
    New Member
    • Mar 2008
    • 166

    VBA Function Assistance

    Hello,

    I have a continuous for which allows my users to select from cascadinig combo material types and the cooresponding materials they would like to use to create a mix. when the user selects they pigment material, they have to input the pigment percent they are using...this is only true when they are using a pigment. My idea was to have in the form's on current event an IIF statement that said If material type is a pigment(cbo_mat TypeId=4), make the text box visible, like so:

    Private Sub Form_Current()

    'If material type is a pigment(cbo_mat TypeId=4), make the text box visible
    If Me.cbo_matTypeI D = 4 Then
    Me.txtPigPercen t.Visible = True
    Else
    Me.txtPigPercen t.Visible = False
    End If

    End Sub

    The issue I am seeing is that because the form is continuous, when the pigment is selected, it shows up for every record, not just the pigments. I tried to put it in the footer but the problem with that method is that if the user uses more than one pigment for a mix, the control being in the footer only represents the pigment percent for one pigment, not the possible many that may be used. How can I make the text box work, if the user has more than one pigment to input?
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    You can't set things for continuous forms in code (easily), but you can do formatting conditions and it will apply separately to each record.
    Now, textbox.visible is not something you can control with a formatting condition, but textbox.enabled is.
    So in design mode you set the txtpigpercent to disabled, in Conditional Formatting set to Expression Is (I'm not sure whether this was available before Access 2007) cbo_matTypeID = 4, and I don't know what that Icon is supposed to be but it's Enabled and it's next to the font color.

    Comment

    • csolomon
      New Member
      • Mar 2008
      • 166

      #3
      Hi Chip,

      Once again, it worked perfectly. Thank you.

      (I'm from Bowie, Maryland! Must be the MD Smarts!)

      Comment

      Working...