Reputation: 1
I am trying to change the font and font size of the text in one box of my form
With Me.[Notes:]
.SetFocus
.FontName = "Verdana"
.FontSize = 8
.ForeColor = vbBlack
End With
I have already looked here
Access VBA programmatically setting font/size not working
And seem to have that working, though I still have a couple of issues.
In case it matters, I'm using MS Access 2016
Thanks in advance,
Daniel
Upvotes: -1
Views: 8944
Reputation: 94
If it's not a continuous form, sounds like you need to add an IF statement to specify under which conditions this should take place. Then place it on the current event of the form.
Private Sub Form_Current()
if condition met then
With Me.[Notes:]
.SetFocus
.FontName = "Verdana"
.FontSize = 8
.ForeColor = vbBlack
End With
end if
end sub
For the second issue you can set the code (or create a procedure and call it) on the afterupdate event of the field
Private Sub notes_AfterUpdate()
if condition met then
With Me.[Notes:]
.SetFocus
.FontName = "Verdana"
.FontSize = 8
.ForeColor = vbBlack
End With
end if
End Sub
Upvotes: 0