3

tablecontinuous formI need to update to visible or invisible a label in a continuous form based on the status of a field in the same record.

I tried with the below but it only takes the value of the first record. In other words it updates visibility to all records based on the first one. If the first record has the field as "converted" then they all get visible... no matter if the rest of the records do NOT have "converted" in that field.

I'm sure I'm doing something wrong but I can't figure out what.

My guesstimate is that I'm addressing the fields wrong using me.fieldname in a continuous form... Should I do something else to get the value for each specific record and affect only that particular record based on that value?

Private Sub Form_Load()

If Me.convertedStatus = "converted" Then
    Me.lblCheckMark.Visible = True
Else
    Me.lblCheckMark.Visible = False
End If


End Sub
Johnny H.
  • 51
  • 4

1 Answers1

0

I think you're looking for the Current event, not the Load event. Current triggers when the record becomes the "current" record, so that's once every time you switch records. Just change Form_Load to Form_Current. Check out this page for more information, if you need it.

Joshua R.
  • 111
  • 4
  • thank you Joshua but this doesn't work. It still updates everything according to one record.. but now it's not the first, it is the one I click on. So all records have their fields visible if i click on a record that has a "converted" field value.... and invisible if I click on a record that does not. – Johnny H. May 25 '16 at 15:19
  • A screenshot of the form might help with diagnosing the issue - I'm not quite sure what you mean by "continuous form" in your question. – Joshua R. May 25 '16 at 15:22
  • Take a look at the following link... it describes how to change the label fild to a text box then use conditional formatting (can't use conditional formatting on a label) http://www.pcreview.co.uk/threads/conditional-formatting-on-a-label.2657374/ – Wayne G. Dunn May 25 '16 at 15:30
  • @JoshuaR. I added 2 pics. I can't post them here directly 'cause I'm new and I don't have the rep to post according to stackoverflow. Basically I'm trying to make a little check mark pop up next to those converted (or in absence of that, turn the background of the field to a different color for converted customers). When I say "continuous form" I meant that the form is set in the property sheet to Default View -> Continuous Forms. Hope this helps. – Johnny H. May 26 '16 at 02:26
  • @WayneG.Dunn - It works. THANK YOU! I have to do what Joshua said along with what you said. – Johnny H. May 26 '16 at 02:35