Thanks to all the replies. I have to take care of some other responsibilities and will come back to this later. So, I don't have time to review all the linked information right now.
@The_Doc_Man - I tried to sort some things out using CharMap and I don't understand the character codes or how to use them in this context to identify a character. I'll google it in a bit. Just wanted to let everyone know.
@strive4peace - Similar statement to above. I tried copying the appropriate characters out of the wingding font set in CharMap and it got converted in the format property and then didn't resolve correctly when loading the form. I'm not 100% clear on what "using unicode characters" means.
Thanks again! When I get back to this, I'll post a resolution or more questions.
Ok, so I'm back. I've mainly figured out the fonts (still don't understand how to specify a 4 digit unicode character but that isn't directly important anymore).
Now, I'm trying to get the VBA code to work correctly and cleanly. The bound field is now an integer field instead of yes/no. Requirements:
1. Needs to be tied to the underlying field.
2. Is either checked (true/-1) or unchecked (false/0). No null. Default field value is 0.
I have an invisible textbox for moving the focus as needed.
Current check/textbox control settings: Locked, Enabled
Issues:
I can also click/hold and drag to select the underlying value.
You can also see the underlying value and cursor when clicking on it.
I'm experimenting with YouTube shorts! I extracted a short piece from the second YouTube video about turning command buttons into checkboxes:-
How to Temporarily Disable the Form's Current Event in Microsoft Access. The Form Current Event is essential for executing code when a user navigates between records. However, you might not want this code to run when the form initially loads. This video demonstrates a simple and effective technique to temporarily disable the Current Event during form load, ensuring your code only runs when it’s truly needed.
Private Sub Form_Current()
MsgBox "First on Current"
Me.OnCurrent = "=fncCurrentEvent()"
End Sub
Private Function fncCurrentEvent()
MsgBox "Subsequent current events"
End Function
Change the event handler after the first on current to the function
I like to use Toggle Button controls in place of checkboxes because they have an inherent Yes/No state like checkboxes but are more flexible to format and size. BUT...I want to show an image ONLY when the state is -1 (True) and not show an image otherwise. So how do you turn on and off an image in a Toggle Button based upon its state?
It turns out Toggle Buttons can read and use images from other Toggle Buttons. So the Toggle button bound to your Yes/No field on your form can use an image from another Toggle button when its state is True and not use it when its state is False.
I like to be able to select specific individual records to print using a Yes/No field, so I:
Created a Yes/No Data Type field in my table
Added one Toggle button on my form bound to the Yes/No field with No Image
Added another Toggle button on my form that is hidden and holds the image I want to use in its image property. In my case, the image is the native ACCESS Printer image like this
So the first record on my customer form looks like this if I want to include Customer A records in my print query:
And looks like this if I don't want to include Customer A:
My bound Toggle button is named CustomerSelection and the Toggle button that contains the image is named CustomerSelectImage
The code I use to Turn on the image if the state is True and turn off the image if the state is False is:
Code:
Private Sub Form_Current()
Call CustomerSelection_Click
Exit Sub
End Sub
Private Sub CustomerSelection_Click()
If Me.CustomerSelection = -1 Then
Me.CustomerSelection.PictureData = Me.CustomerSelectImage.PictureData
Else
Me.CustomerSelection.PictureData = Null
End If
Me.Form.Recalc
Exit Sub
End Sub
As you can see, it uses the PictureData property of the Toggle button that holds the image.
Setting the image to Null when the state is False was just blind luck. I tried =Null and it worked. Sometimes you just get lucky.
Notice you need to refresh things when you move from record to record with the Form Current Event