Problem with Toggle Button.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.

There's only *one button* on the form - displayed many times. Changing its
properties changes the properties for all instances of the button (because
it's all the same button!)

Instead, if you have A2000 or later, use Format... Conditional Formatting to
set the format of the control.

John W. Vinson [MVP]
 
yes, that's what will happen, because there's only one button, and the form
is showing multiple instances of that one button. *instead of* code on the
button's click event, try using Conditional Formatting. see Format |
Conditional Formatting on the menu bar in form Design view.

hth
 
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
 
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]
 
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
 
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]
 
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).
 
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]
 
Ok, but what do you mean by an informative string? I am not sure what that is?

Thanks for the idea. Dustin
 
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]
 

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

Back
Top