Update label visibility when record changes

UPachqge

New member
Local time
Today, 11:50
Joined
Jun 22, 2011
Messages
9
Hello,

I have a label which I want to set as visible when a textbox is greater than a certain value. When that textbox is less than the certain value, I want the label to not be visible.

I'm able to get it working with a command button using an If statement. With the same If statement, in the On Current event of the form, it will change to visible but when selecting a new record (via combo box) the label will stay, even if the textbox is below a certain value.

How can I get the label to change when selecting a new record like I can with a button? I have a feeling I'm missing something simple with where to put the If statement in some form event.

Working If statement on button:

Private Sub Command99_Click()
If Me.Text_Minutes < 1900 Then
Me.AgentMax.Visible = False
Else
Me.AgentMax.Visible = True
End If
End Sub
 
Try putting it in BOTH the form's On Current event AND the After Update event of the combo (after the code which does the search to the new record). (although I don't know why it wouldn't do it on a move to another record because the On Current event should fire with that).
 
Oh, and you can change your code to this (shortened down):
Code:
Me.AgentMax.Visible = (Nz(Me.Text_Minutes,0) >= 1900)
you don't need the other code.
 
Thanks for the shorter code Bob. Unfortunately, what you first suggested isn't working for me.

The combo box is performing a search with an AfterUpdate embedded macro using action "SearchForRecord"; could this be causing problems with your suggestion?
 
Try putting it in BOTH the form's On Current event AND the After Update event of the combo (after the code which does the search to the new record). (although I don't know why it wouldn't do it on a move to another record because the On Current event should fire with that).

Got it working by using the combo box On Change event. You set me on the right thought pattern, thank you for the help.
 

Users who are viewing this thread

Back
Top Bottom