Topic: Changing font properties in subforms

poyraz1108

New member
Local time
Today, 18:28
Joined
Feb 11, 2013
Messages
4
I wonder if anyone else has had this problem, and whether they have found a solution?

I have a Main Form, on which is a Subform, in datasheet view. The text boxes on the subform are bound to an underlying table. The font properties of these text boxes on the subform have been set manually in the text box properties sheets.

Now, I want to add a command button to the Main Form that will allow the user to change the FontSize of all the text boxes displayed on the subform as a datasheet.

This should be simple, you would think. Indeed, it is possible to change the font of a text box on a subform by code such as:
intFontSize = 10
Forms!ViewTransactions!sfrViewTransactions.Form!txtTransactionDetails.
FontSize = intFontSize


However, this does not change the appearance of the text box in datasheet view on the subform itself. The properties sheet shows 10pt, but the subform datasheet stays at the original 8pt size on the screen.


Getz et al provide code for the Common Dialog class module (Access 2000 Developer’s Handbook 1, pp1232ff) on their CD, with an option to allow the user to change font properties via a dialog box. Plugging this code into my application works to the extent that it changes the font properties of the text box, through am MS Office-type dialog box, but, again, the appearance of the text box on screen does not change!


The only way to change the appearance of a text box in datasheet view on a subform seems to be to use the Menu Bar’s Format command. This works by placing the cursor in the subform datasheet and Format > Font > select a font > OK. This changes the appearance of all cells in the subform datasheet, but does not change the properties sheets for these text boxes.


Can anyone solve this conundrum? I don’t want to have the user go to the menu bar to change the appearance of fonts; I want to control them with a command button.
 
Have you tried the DatasheetFontHeight?

Code:
Private Sub AButtonName_Click()
'It change the font size to 20   
Me.YourSubDataSheetformname.Form.DatasheetFontHeight = 20
End Sub
 
Thanks very much for this; the code works fine. It also accepts the syntax Me!subformname....

I shall now add two buttons to increment and decrement the font size according to the user's desires.

Curiously, once again, this code does not change the font sizes on the Properties sheet.
 

Users who are viewing this thread

Back
Top Bottom