Full Version: Trouble with a Label
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Vongalin
Hello all. In an attempt to create a "larger" checkbox I am working with code that I found here. Basically it hides the checkbox and switches the value and caption when you click a label (to WingDings chr(252)). The problem I am having is - regardless of the value of the checkbox, the label is the same for all the records on the form.

lblMON is a static label that shows the day of the week (Mon, Tue, etc.)
chkMONPD is bound to the table (for a yes/no field)
lblMONPD is the label to show the fancy checkmark. NOTE : I have a different label for each day, lblTUEPD, etc. The following example is for a Monday.

The OnClick for the lblMONPD label is this:
CODE
Call CheckPD("MON")

which calls this:
CODE
Private Sub CheckPD(strDay)
    Me.Controls("chk" & strDay & "PD") = Not Me.Controls("chk" & strDay & "PD")
    If Controls("chk" & strDay & "PD") = True Then
        Controls("lbl" & strDay & "PD").Caption = Chr(252)
    Else
        Controls("lbl" & strDay & "PD").Caption = " "
    End If
End Sub

and this is the OnCurrent for the form:
CODE
    Dim arrDays
    Dim strDay
    
    arrDays = Array("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN")

    For Each strDay In arrDays
        If IsNull(txtNumber.Value) Then
            Me.Controls("lbl" & strDay & "PD").Visible = False
        Else
            Me.Controls("lbl" & strDay & "PD").Visible = True
            If Me.Controls("chk" & strDay & "PD") = True Then
                Me.Controls("lbl" & strDay & "PD").Caption = Chr(252)
            Else
                Me.Controls("lbl" & strDay & "PD").Caption = " "
            End If
        End If
    Next

Is it not possible to have a different caption for the label for each record ?
Bob_L
Not on a continuous form. If you want that then you will need to include a field to store the results for each record and then use a text box Formatted to LOOK like a label.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.