Problem with Toggle Button.

D

Dustin

Hi there.

All I want is for the font to turn Red and Bold when the button is clicked
true and the record to stay that way. Until it is clicked false in the
future and turned back to Black and bold. But with this code I am turning all
the buttons red in each record on the continuous subform.

When I just want the record I clicked the button in to turn Red. Not the
rest of the records.

Here is the code I am using.

Private Sub CallBackBtn_Click()
If Me.CallBackBtn = True Then
Me.CallBackBtn.FontBold = True
Me.CallBackBtn.ForeColor = vbRed
Else
If Me.CallBackBtn = False Then
Me.CallBackBtn.FontBold = True
Me.CallBackBtn.ForeColor = vbBlack
End If
End If
End Sub

Any help would be great!

Thanks Dustin
 
D

Dustin

Ok, that makes sense. But when I highlight the button in design view the
Conditional Formating under Format is not availible for use. What am I doing
Wrong?

Thanks for the response! Dustin
 
J

John W. Vinson

Ok, that makes sense. But when I highlight the button in design view the
Conditional Formating under Format is not availible for use. What am I doing
Wrong?

You might need to superimpose a transparent Label over the button, and apply
the conditional formatting to it.

John W. Vinson [MVP]
 
D

Dustin

Ok, I put the transperent label over top of the button and highligted it so
all the squares were around it and conditional formatting still wasn't
allowed.

Am I doing something wrong? Thanks for your help. Dustin
 
J

John W. Vinson

Ok, I put the transperent label over top of the button and highligted it so
all the squares were around it and conditional formatting still wasn't
allowed.

Sorry! Memory lapse is my only excuse. Command buttons and labels don't
support conditional formatting - only textboxes and other such data-bound
controls.

Other than putting an unbound textbox next to the button and changing its
appearance, I don't know a good way to accomplish what you want.

John W. Vinson [MVP]
 
G

George Nicholson

only textboxes and other such data-bound controls.

AFAIK (Access 2003):

Textboxes & combos support conditional formatting.

Command buttons, toggle buttons, option/radio, check boxes, listboxes and
option frames do not, whether data-bound or not.

Almost all Help entries on the subject makes you think conditional
formatting can be applied to almost any control, while the reality is it's a
very short list (and data-bound doesn't seem to be a criteria).
 
J

John W. Vinson

Ok, I put the transperent label over top of the button and highligted it so
all the squares were around it and conditional formatting still wasn't
allowed.

Am I doing something wrong? Thanks for your help. Dustin

Again:

You're doing nothing wrong.
Command buttons and labels do not support conditional formatting.
My suggestion was wrong (my mistake); I don't think there is any way to make a
button change its appearance on multiple rows of a continuous form in Access.

What you can do is put a Textbox adjacent to the button; set its control
source to an informative text string, and apply conditional formatting to that
textbox.

John W. Vinson [MVP]
 
D

Dustin

Ok, but what do you mean by an informative string? I am not sure what that is?

Thanks for the idea. Dustin
 
J

John W. Vinson

Ok, but what do you mean by an informative string? I am not sure what that is?

Since I have no idea what your database does, or what the bold/red/etc. that
you want in the button means, all I can say is "I don't know". Maybe have a
big bold capital letters "ON" in red if the yes/no field is true, and change
its color to the same as the textbox's background color if it's off.

John W. Vinson [MVP]
 
Top