Toggle On Off Button

isladogs

MVP / VIP
Local time
Today, 04:48
Joined
Jan 14, 2017
Messages
18,399
Hi all

Does anyone know of a form control which can act in a similar way to those below.

attachment.php


I looked through the Active X list but can't see anything obvious that's similar

Happy Xmas to everyone
 
Last edited:
Not aware of one offhand, but can you use two stacked images and set their Visible property accordingly?

Not sure of any way to handle nice transitions in Access though.

If you really wanted to could embed a web browser and use any one of hundreds of HTML/CSS ones, but that's a bit much.

Cheers
 
I thought of 2 images but felt it would look clunky
Or a 2 value slider .. also clunky

I thought it would be a neater way of setting program settings than a Yes/No or On/Off combo
However, unless there's a ready made control, it isn't really worth the effort
 
I was thinking of 2 images also. And thinking setting a default, then on click revert to other image, but it seems clunky (if doable, at best). Saw this from Gina, but no already built control.

Merry Christmas.
 
Hi Jack

Thanks for the link to Gina's site - I've not looked at it for a long time.
Have a great Xmas
 
you can use a button - use format to select a quick style but you would need code to set border, back and fore colors - plus code to change the alignment. Use Windings font (lowercase L) or webdings (lowercase N)

the code would be something like

Function formatButton(isOn as Boolean, ctrl As Control)

If isOn Then
ctrl.BorderColor = vbBlue
ctrl.BackColor = vbBlue
ctrl.ForeColor = vbWhite
ctrl.Alignment = 3
Else
ctrl.BorderColor = vbBlack
ctrl.BackColor = vbWhite
ctrl.ForeColor = vbBlack
ctrl.Alignment = 0
End If

End Function
code needs a bit more for the hover

attachment.php
 

Attachments

  • Capture.JPG
    Capture.JPG
    1.8 KB · Views: 444
Last edited:
Hi Chris
Many thanks for my Xmas present :)

attachment.php


It never occurred to me to use Quick Styles - in fact I tend to forget they exist!
2 minutes work & I have exactly what I wanted!
The hover colour bit was also easy

Definitely worth giving you more RPs but the forum rules won't let me do so again

So all I can do is to say a very merry Xmas to you as well Chris :D

EDIT: Now if you can also help me retrieve my own code from an accde file where I've deleted the original accdb, I'll know for sure Santa Claus exists ...
 
Last edited:
Wayne Phillips can do that for you. I'm not sure he dresses up in a red suit though.

http://www.everythingaccess.com/mdeconversion.asp

Cheers

Thanks Jack.
That's good to have in reserve for future reference

However Santa really has arrived as I found the old accdb file
And much more importantly I've just become a proud grandparent in the last half hour. Baby boy born just after 1am on Xmas day

Signing off now.
Happy xmas
 
Colin,

Glad you have it resolved. And congrats on the Christmas baby!!!
 
Thanks. Best present ever. Mum and baby Charlie both doing well.
 
Over 4 years later, I wrote a web page about this:

The article was noticed by Mike Wolfe who has taken the idea further in a series of three articles starting with:

His latest article extends the toggle slider switch to support triple state for unbound controls:

1661004370750.png
 
Last edited:

Users who are viewing this thread

Back
Top Bottom