• Change control height (2003)

    Author
    Topic
    #430947

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1007493

      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.

      • #1008105

        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

        • #1008107

          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

    Viewing 0 reply threads
    Reply To: Reply #1008107 in Change control height (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel