Results 1 to 8 of 8
  1. #1
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14

    Sliding Form

    Hi
    I am working on MS Access 2013 trying to make one of the form to be sliding after click a command button "Command3", the syntax in Code Builder/Click is as hereunder:

    Private Sub Command3_Click()
    Do Until Me.Height > 7000
    Me.Height = Me.Height + 1
    DoEvents
    Loop
    End Sub


    but it does not work.

    what is exactly the wrong.

    Regards

  2. #2
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    There are a couple of things. One, Access Forms do not have a Height property. Different sections of a form have the height property, though. Also, this is a Design Time edit. When a user interacts with a form, this is Run Time. When a developer builds a form, this is design time. Make design changes to a form object while in Design View of the form.

    There are some tricks to make design changes via VBA code. Basically, they need to be done while in Design View. So you would open the Form using the Edit Mode argument in the DoCmd OpenForm method. There is another trick using Hidden Mode. So, no real way that I am aware of to have a user interact with a form and adjust the Detail Height while the user is viewing the form in Run Time.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    use the move and window parameters e.g.

    Code:
    Private Sub Command3_Click()
    Dim i As Single
    
        For i = WindowHeight To WindowHeight + 2000
            Me.Move WindowLeft, WindowTop, WindowWidth, I
            DoEvents
        Next I
    
    End Sub
    or for something that accelerates

    Code:
    For i = 1 To 100
        Me.Move WindowLeft, WindowTop, WindowWidth, WindowHeight + I
        DoEvents
    Next i

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Ajax View Post
    use the move and window parameters e.g...
    Is that what they are trying to do? Move the Windows window? I wonder if that would work on a Pop-Up form.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    it just increases the height per the example the OP posted in #2.

    I've used the principle in the past to make using the db a bit more interesting when presenting information - forms expanding out from the side, top or bottom sort of thing

    for an ordinary form, it works in the form open/load/current events, but for popup (and/or modal) it has to work off some event once the form is opened - such as clicking a button. Reason, the form is not visible until open/load and current events have occurred. I've had a form 'peek' out the side so user is aware and then used the form mousemove event to expand further (plus some additional control to stop it expanding indefinitely!) when the user moves over it.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Interesting, I did not know that.

  8. #8
    Ossos is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    14
    Thank you All, it works wonderful.

    Regards.

Please reply to this thread with any new information or opinions.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums