Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A97 datasheet alignment (A97 SR-2)

    I have a main form which contains a subform opened in datasheet mode. What I want to do is add some controls (containing totals) on the main form and align them horizontally with the appropiate columns on the datasheet. I want to calculate the effective 'Left' value of the column on the datasheet so that I can set the real Left property of the corresponding control on the main form.

    However, when I open the subform separately and right-click the columns I see the Column Widths value is 33.833. My question is how do I convert this to twips or cms or something I can use. The Access Help tells me this value is in points which is 1/28 of a cm. But this does not compute, as the width on the screen is about 6.3 cms.

    Does anybody have any bright ideas on this - allowing for the fact I cannot change the subform from Datasheet display ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: A97 datasheet alignment (A97 SR-2)

    This is tricky, since users can change the column widths.

    When you view or set the column width interactively, it is measured in "character widths", a rather useless unit. In VBA, it is measured in twips, where 1 inch = 1440 twips. If the ColumnHidden property of a column is True, the effective width is 0, but ColumnWidth keeps its old value, unless the column was hidden by setting the column width explicitly to 0. So you have to check both the ColumnWidth and the ColumnHidden properties when determining the width of a column.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A97 datasheet alignment (A97 SR-2)

    Hans

    Thanks for that. As you say, this is indeed a tricky one. What complicates it even more is that this is an Access front-end, sitting on a SQL Server database. So there are no Access tables, hence no fields, hence no Columnwidth properties to be accessed - is that right ?

    I think I might just have to use the old 'best visual fit' method' & hope no one can 'spot the joins'

    Nick

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: A97 datasheet alignment (A97 SR-2)

    In a datasheet form, ColumnWidth is a property of the controls (text boxes) on that form.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A97 datasheet alignment (A97 SR-2)

    Hans

    Thank you again. I am using code triggered on the form's Load event to set the ColumnWidth property (which is only accessible in VBA) for the controls.

    Nick

Posting Permissions

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