Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Location
    Belgrade
    Posts
    68

    Unanswered: Altering Access Datasheet at runtime

    Is there a way to alter the font of an Access Datasheet at runtime?

    The problem is the following: on a form I have a subform that works in Datasheet mode. As it usually displays quite a lot of rows (1000 - 3000 and I can't reduce that number) I would like to use a smaller font in order to display more rows on one screen and avoid excessive scrolling.

    I know that under Tools >> Options I can set the font and other parameters for Datasheet views. The problem is that any setting entered there is permanent and affects all subsequent Datasheets.

    What I need is to set temporarily a smaller font type/size when my app starts and revert back to the default settings when my app exits. (Basically, it is the same functionnality as choosing a smaller Zoom percentage in Excel.)

    Can anyone help me?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can go throught each textBox on your form with for ... each and change the font size....

  3. #3
    Join Date
    Aug 2003
    Location
    Belgrade
    Posts
    68
    Yes, but anything you set that way affects only the Form View, not the Datasheet View.

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Altering Access Datasheet at runtime

    Originally posted by mashinovodja
    Is there a way to alter the font of an Access Datasheet at runtime?

    The problem is the following: on a form I have a subform that works in Datasheet mode. As it usually displays quite a lot of rows (1000 - 3000 and I can't reduce that number) I would like to use a smaller font in order to display more rows on one screen and avoid excessive scrolling.

    I know that under Tools >> Options I can set the font and other parameters for Datasheet views. The problem is that any setting entered there is permanent and affects all subsequent Datasheets.

    What I need is to set temporarily a smaller font type/size when my app starts and revert back to the default settings when my app exits. (Basically, it is the same functionnality as choosing a smaller Zoom percentage in Excel.)

    Can anyone help me?
    Might this be of help?

    From the help files:

    DatasheetFontWeight Property

    You can use the DatasheetFontWeight property to specify the line width of the font used to display and print characters for field names and data in Datasheet view. Read/write Integer.

    expression.DatasheetFontWeight

    expression Required. An expression that returns one of the objects in the Applies To list.

    Remarks
    The DatasheetFontWeight property applies to all fields in Datasheet view and to form controls when the form is in Datasheet view.

    These properties are only available in Visual Basic within a Microsoft Access database (.mdb)

    Gregg

  5. #5
    Join Date
    Aug 2003
    Location
    Belgrade
    Posts
    68

    Re: Altering Access Datasheet at runtime

    Thank you Gregg, this is exactly what I needed. I didn't know the Datasheet had properties available in VBA.

    In addition to DatasheetFontWeight, I also found useful the DatasheetFontHeight and DatasheetFontName properties.

    It is a pity that no properties of individual Datasheet cells can be set independently, otherwise the Datasheet would have made a very acceptable grid control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •