Interacting with label control of checkbox's

T

Ted

I have created a form with a slew of checkboxes and have written some VBA so
that when the box is checked the color of the associated label's changes
along with the foreground text's. I note that the value of the checkbox's can
be controlled by the user's either clicking the checkbox control or the
associated label control. There is however one 'rogue' checkbox on this same
form whose label can not be used like the others'. I attach the relevant code
but it seems not to be materially different from the code used to govern the
other checkboxes.

Private Sub Complete_AfterUpdate()

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If

End Sub

Private Sub Form_Current()

........ denotes other code above the following

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If


..... denotes other code below the above

End Sub

Any thoughts?
 
D

Douglas J. Steele

You sure that the misbehaving checkbox's label is actually associated with
that checkbox?

Try selecting the label, cutting it to the clipboard (Ctrl-X), selecting the
checkbox, and pasting the label back from the clipboard (Ctrl-V).
 
T

Ted

Hi Doug,

Before your response, I copied the Form and created another in the same mdb.
I deleted the label/checkbox controls in my mention and created a new
checkbox using the little 'tool' atop the window. I gave each the names of
the two deleted ones and re-created the same events. While the clicking thing
I was complaining about is rehabilitated, the new problem is that the value
of the checkbox and color in the label do not change from record to record?



Douglas J. Steele said:
You sure that the misbehaving checkbox's label is actually associated with
that checkbox?

Try selecting the label, cutting it to the clipboard (Ctrl-X), selecting the
checkbox, and pasting the label back from the clipboard (Ctrl-V).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
I have created a form with a slew of checkboxes and have written some VBA
so
that when the box is checked the color of the associated label's changes
along with the foreground text's. I note that the value of the checkbox's
can
be controlled by the user's either clicking the checkbox control or the
associated label control. There is however one 'rogue' checkbox on this
same
form whose label can not be used like the others'. I attach the relevant
code
but it seems not to be materially different from the code used to govern
the
other checkboxes.

Private Sub Complete_AfterUpdate()

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If

End Sub

Private Sub Form_Current()

....... denotes other code above the following

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If


.... denotes other code below the above

End Sub

Any thoughts?
 
D

Douglas J. Steele

Are you saying that it changes to the same thing for every record? Unless
the checkboxes are bound to fields in the form's recordsource, that's how it
is.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
Hi Doug,

Before your response, I copied the Form and created another in the same
mdb.
I deleted the label/checkbox controls in my mention and created a new
checkbox using the little 'tool' atop the window. I gave each the names of
the two deleted ones and re-created the same events. While the clicking
thing
I was complaining about is rehabilitated, the new problem is that the
value
of the checkbox and color in the label do not change from record to
record?



Douglas J. Steele said:
You sure that the misbehaving checkbox's label is actually associated
with
that checkbox?

Try selecting the label, cutting it to the clipboard (Ctrl-X), selecting
the
checkbox, and pasting the label back from the clipboard (Ctrl-V).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ted said:
I have created a form with a slew of checkboxes and have written some
VBA
so
that when the box is checked the color of the associated label's
changes
along with the foreground text's. I note that the value of the
checkbox's
can
be controlled by the user's either clicking the checkbox control or the
associated label control. There is however one 'rogue' checkbox on this
same
form whose label can not be used like the others'. I attach the
relevant
code
but it seems not to be materially different from the code used to
govern
the
other checkboxes.

Private Sub Complete_AfterUpdate()

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If

End Sub

Private Sub Form_Current()

....... denotes other code above the following

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
Me![Label59].Caption = "Form is Complete"

End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
Me![Label59].Caption = "Form is Incomplete"
End If


.... denotes other code below the above

End Sub

Any thoughts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top