Formatting datasheet font sizes (Access 2010)

Metta

New member
Local time
Today, 10:29
Joined
Aug 21, 2013
Messages
8
Using Access 2010, I have a subform in datasheet view and I want to set the font size to 10pt. Setting font sizes for datasheet fields in the Format tab does not change the font size displayed.

I understand that the font size can be set using VBA (for example: Me.DatasheetFontHeight=10). Where do I put this code for it to work in a) a single datasheet b) all datasheets in the db?

Or - is there another way to do this?

Thanks
 
The thing you have to understand is that by using code in the OnLoad or OnOpen event, you are setting the Font Size for only that Datasheet, while going to Options - Datasheets - Default Font to make the change, you're changing the Font Size for all Datasheets...not only all Datasheets in that particular Database, but in all Databases run under that copy of Access on that machine!

By the same token, changing it by going to Options - Datasheets - Default Font on the development machine will not effect how Datasheets are displayed when the app is deployed to other machines! To control how a DS is displayed on all machines running a given DB you must use code for each one.

And since we're speaking of Datasheets, here's an article I came across a while back that may be of interest:

You Can Do That with Datasheets?

Linq ;0)>
 
I put the code in the OnLoad function, and it works fine - thanks.

However, when I close the form which contains two datasheets with this code in their OnLoad settings, I get a prompt to Save the subforms - even when no change has been made to the forms by the user. Is there something I can do to avoid this prompt popping up? (It's the first form viewed in the frontend, so will be used often and having this prompt every time will be a nuisance.)

Thanks
 
However, when I close the form which contains two datasheets with this code in their OnLoad settings, I get a prompt to Save the subforms - even when no change has been made to the forms by the user.
Thanks
Hmm - I can't reproduce this behaviour at an example I've made here.
Could you post a copy of the database with some sample data in it.
 
Hi JHB, thanks for giving it a go. It seems to be a problem only sometimes. I've gone around the issue by creating an accde for users, so it's a non-issue from their perspective.
 

Users who are viewing this thread

Back
Top Bottom