Toggle On Off Button (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
Hi all

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



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

Happy Xmas to everyone
 
Last edited:

jleach

Registered User.
Local time
Today, 09:45
Joined
Jan 4, 2012
Messages
308
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
 

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
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
 

jdraw

Super Moderator
Staff member
Local time
Today, 09:45
Joined
Jan 23, 2006
Messages
15,362
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.
 

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
Hi Jack

Thanks for the link to Gina's site - I've not looked at it for a long time.
Have a great Xmas
 

CJ_London

Super Moderator
Staff member
Local time
Today, 13:45
Joined
Feb 19, 2013
Messages
16,553
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

 

Attachments

  • Capture.JPG
    Capture.JPG
    1.8 KB · Views: 392
Last edited:

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
Hi Chris
Many thanks for my Xmas present :)



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:

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
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
 

jdraw

Super Moderator
Staff member
Local time
Today, 09:45
Joined
Jan 23, 2006
Messages
15,362
Colin,

Glad you have it resolved. And congrats on the Christmas baby!!!
 

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
Thanks. Best present ever. Mum and baby Charlie both doing well.
 

isladogs

MVP / VIP
Local time
Today, 13:45
Joined
Jan 14, 2017
Messages
18,186
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

Top Bottom