Recurrence of font bug in MS Access 365 Version 2311? (1 Viewer)

Lunesta

New member
Local time
Today, 06:04
Joined
Oct 6, 2023
Messages
4
After apparently being resolved last month, I'm seeing a recurrence of the kind of issue discussed by @isladogs with my chosen font in forms being replaced (mostly in form labels but in some text boxes also) by another font -- in this case by a font called "OS Sans Serif." Anyone else seeing this?

I'm running Microsoft® Access® for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20028) 32-bit.

Thanks.
 

isladogs

MVP / VIP
Local time
Today, 12:04
Joined
Jan 14, 2017
Messages
18,225
Hi
I've seen it once recently again with Sans Serif as the replacement font
However I assumed it was a file I'd opened during the time the bug was still in effect

Try checking either a brand new file or one you haven't opened in several months. Does it still occur?
 

Lunesta

New member
Local time
Today, 06:04
Joined
Oct 6, 2023
Messages
4
Hi.

I've just tried with a new form and it seemed to retain my Segoe font setting.

However, the problematic form is still resetting itself to OS Sans Serif.

Forms in the database that I hadn't opened recently seem to be okay.

For the time being, I'm using the following VBA code in Form_Open. I know it's not an optimal solution, but it seems to work.

Code:
    Dim ctrl As Control

    For Each ctrl In Me.Controls
        ' Check if the control is a textbox or label
        If TypeName(ctrl) = "TextBox" Or TypeName(ctrl) = "Label" Or TypeName(ctrl) = "ComboBox" Then
            ' Set font properties
            ctrl.FontName = "Segoe UI"
            ctrl.FontSize = 8
            ctrl.FontWeight = 400  ' Normal
        ElseIf TypeName(ctrl) = "CommandButton" Then
            ' Set font properties for button
            ctrl.FontName = "Segoe UI"
            ctrl.FontSize = 8
            ctrl.FontWeight = 400  ' Normal
        End If
    Next ctrl

--John
 

cheekybuddha

AWF VIP
Local time
Today, 12:04
Joined
Jul 21, 2014
Messages
2,280
Hello John,

Out of curiosity, why do you separate the settings for CommandButton when they are identical to the other types of controls?

Perhaps cleaner:

Code:
    Dim ctrl As Control

    For Each ctrl In Me.Controls
        ' Check if the control is a textbox or label or command button
        Select Case TypeName(ctrl)
          Case "TextBox", "Label", "ComboBox", "CommandButton"
            ' Set font properties
            ctrl.FontName = "Segoe UI"
            ctrl.FontSize = 8
            ctrl.FontWeight = 400  ' Normal
          Case Else
        End Select
    Next ctrl
 

Lunesta

New member
Local time
Today, 06:04
Joined
Oct 6, 2023
Messages
4
Thanks. The simple answer is that I generally don't quite understand what I'm doing.
 

cheekybuddha

AWF VIP
Local time
Today, 12:04
Joined
Jul 21, 2014
Messages
2,280
Thanks. The simple answer is that I generally don't quite understand what I'm doing.
Don't worry - that is a fairly common predicament for most of us here at one time or another! 😬

Just keep asking the questions, and the pieces will soon start to fall in to place. (y)
 

Lunesta

New member
Local time
Today, 06:04
Joined
Oct 6, 2023
Messages
4
Don't worry - that is a fairly common predicament for most of us here at one time or another! 😬

Just keep asking the questions, and the pieces will soon start to fall in to place. (y)
Thanks. I appreciate your good will!
 

MarkK

bit cruncher
Local time
Today, 04:04
Joined
Mar 17, 2004
Messages
8,181
Having some free time on my hands, I thought I'd see if I could programmatically determine controls that support text properties. This works, but could have a performance cost if you have a ton of controls, so I added a timer....
Code:
Private Sub Form_Load()
    SetControlFonts
End Sub

Private Sub SetControlFonts()
    Dim ctrl As Control
    Dim clock As Single ' to test performance
    
    clock = Timer
    For Each ctrl In Me.Controls
        If HasFontProperties(ctrl) Then
            ctrl.FontName = "Segoe UI"
            ctrl.FontSize = 8
            ctrl.FontWeight = 400  ' Normal
        End If
    Next ctrl
    Debug.Print "Set Fonts Timing: " & Round(Timer - clock, 6) & "sec"
End Sub

Private Function HasFontProperties(ctrl As Control) As Boolean
On Error Resume Next
    ' this line causes an error if the property does not exist
    ' and the function value defaults to false
    HasFontProperties = TypeName(ctrl.FontName) = "String"
End Function
I ran this over 19 controls of most control types on a test form, seven of which support fonts, and even rounded to 6 decimal places, this takes zero seconds on my machine.
Cheers,
 

isladogs

MVP / VIP
Local time
Today, 12:04
Joined
Jan 14, 2017
Messages
18,225
Hi @MarkK
Sorry but not sure I see the relevance of your code to the question asked by the OP in this thread
 

MarkK

bit cruncher
Local time
Today, 04:04
Joined
Mar 17, 2004
Messages
8,181
Colin. My post is whimsical, unrelated, and exists for the pure joy of writing code. Thanks for noticing.
Having some free time on my hands, I thought I'd see if
I had some free time on a day, tried to solve a problem this thread suggested to me, and I posted those results. : )
 

cheekybuddha

AWF VIP
Local time
Today, 12:04
Joined
Jul 21, 2014
Messages
2,280
I think it's pretty neat, since you don't need to know in advance which controls to change. If this routine is required due to the bug, then you can just drop it in and forget about it.
 

isladogs

MVP / VIP
Local time
Today, 12:04
Joined
Jan 14, 2017
Messages
18,225
Colin. My post is whimsical, unrelated, and exists for the pure joy of writing code. Thanks for noticing.

I had some free time on a day, tried to solve a problem this thread suggested to me, and I posted those results. : )
LOL!
 

isladogs

MVP / VIP
Local time
Today, 12:04
Joined
Jan 14, 2017
Messages
18,225
@Lunesta
I can now confirm that the font display bug has reappeared - in my case Calibri replaced by OS Sans Serif which isn't actually a listed font

1702058793887.png


I've just reported it to the Access team & also referenced this thread.
 

isladogs

MVP / VIP
Local time
Today, 12:04
Joined
Jan 14, 2017
Messages
18,225
Very quick response from the Access team. This will be fixed next week.
 

Users who are viewing this thread

Top Bottom