Results 1 to 5 of 5

Thread: Moving a form at run time

  1. #1

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Moving a form at run time

    Access:

    How do I have my form (no borders) move when I click the background?

  2. #2
    Registered User
    Join Date
    Jun 1999
    Location
    palmdale, ca. USA
    Posts
    150

    move...

    move to where when you click the background ?

  3. #3

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    ....

    I want to click down and move the form where ever I want. I know how to do this in VB but not in VBA for Access.

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    Put this in your module:
    VB Code:
    1. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    2. Public Declare Function ReleaseCapture Lib "user32" () As Long

    And this in your Detail Mousedown event. You can drag it around by the form detail section.
    VB Code:
    1. Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. ReleaseCapture
    3. SendMessage Me.hwnd, &HA1, 2, 0&
    4. End Sub

  5. #5

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Thanks

    Ephesians

    That works great for me thnanks again.

Posting Permissions

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



Click Here to Expand Forum to Full Width