Referencing specific label in Access subform - Stack Overflow

I have a Form and Subform, similar to a simple order entry system.Everything works fine, except for t

I have a Form and Subform, similar to a simple order entry system. Everything works fine, except for this. When I enter information on the subform, I would like a certain label to be visible or invisible depending on the name that was selected in a combo box (populated from another table).

Currently the subform AfterUpdate event for the combo box says this:

If cmbMName.Column(2) = True Then
    lblAddMileage.Visible = True
Else
    lblAddMileage.Visible = False
End If

The problem with this is that if there are multiple entries, all lblAddMileage labels (each line) on the subform will be visible or invisible. Is there a way to make only the single entry visible or invisible?

I have a Form and Subform, similar to a simple order entry system. Everything works fine, except for this. When I enter information on the subform, I would like a certain label to be visible or invisible depending on the name that was selected in a combo box (populated from another table).

Currently the subform AfterUpdate event for the combo box says this:

If cmbMName.Column(2) = True Then
    lblAddMileage.Visible = True
Else
    lblAddMileage.Visible = False
End If

The problem with this is that if there are multiple entries, all lblAddMileage labels (each line) on the subform will be visible or invisible. Is there a way to make only the single entry visible or invisible?

Share Improve this question asked Feb 21 at 17:47 RKreidlerRKreidler 11 silver badge 1
  • 1 No. Alternative is to use a textbox as a "label" and IIf() expression in textbox displays text or Null depending on condition. – June7 Commented Feb 21 at 18:18
Add a comment  | 

1 Answer 1

Reset to default 1

Yes, there is a nice workaround. Use a TextBox instead. Set the Control source to ="Label Caption", and the properties Enabled = No and Locked = Yes.

Now, right-click on this textbox and select Conditional Formatting... and add a rule, so that when the condition is met, you set the text color equal to the background color, which makes the label invisible.

This rule is applied to each row individually.

The result looks like this:

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745162855a4614473.html

相关推荐

  • Referencing specific label in Access subform - Stack Overflow

    I have a Form and Subform, similar to a simple order entry system.Everything works fine, except for t

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信