Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change control height (2003)

    I want to change the height of a control on a form when I enter the control and then change it back again once I exit the control.

    I'm using on enter and on exit events to do this, but need some help with two problems:

    Firstly I started by entering ControlName.Height = 7 but this made the control disappear - I then realised that this measurement isn't centimetres, but something else - what is the something else and how many something elses per centimetre?

    Secondly, when I modify the height of the Control I also need to modify the height of the Detail section. I have managed to do this using:
    Detail.Height = 1000
    Detail.ControlName = 900

    The problem I have is that if I choose a record further down the list, the chosen record can disappear off the screen as the other records also expend to a height of 1000. How can I make the chosen record move to the top of the screen so that the expansion will not have an effect as the record to be edited will be visible.

    John

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

    Re: Change control height (2003)

    Height etc. are measured in twips, where 1 inch = 1440 twips, or 1 cm ~ 567 twips.

    It is not easy to position a record at the top of a continuous form. The only way I know is to move to the first (or last) record, then back to the current record. Unless that record is already visible, Access will scroll it to the top of the form. But in many cases, it is not desirable or efficient to move to another record and back.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change control height (2003)

    What code would I use to jump to the last record and then back to the original current record - the selected record will probably be only about 10-20, s I think jumping forward then back would be OK as a solution

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

    Re: Change control height (2003)

    Something like this:

    Dim bmk As Variant
    ' Store current position
    bmk = Me.Bookmark
    ' Go to last record
    RunCommand acCmdRecordsGoToLast
    ' Restore original position
    Me.Bookmark = bmk

    or

    Dim lngRec As Long
    ' Store current record number
    lngRec = Me.CurrentRecord
    ' Go to last record
    DoCmd.GoToRecord , , acLast
    ' Return to original record
    DoCmd.GoToRecord , , acGoTo, lngRec

Posting Permissions

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