In order to move a borderless form in Ms Access, there are couple of things you can do.
Step 1
1. Create your form.
Step 2
2. Change the border style of the form to "None" under the Format tab in the property sheet.
Step 3
3. Change the form Pop Up to "Yes" under the other tab in the property sheet.
Step 4
4. Create a module and name it as Mod_Moveform. Past code below into module.
Option Compare Database
Option Explicit
Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As LongPtr, _
ByVal wMsg As Long, _
ByVal wParam As LongPtr, IParam As Any) As Long
Public Declare PtrSafe Function ReleaseCapture Lib "user32.dll" () As LongPtr
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HT_CAPTION = &H2
Step 5.
5. Click on the form header, and under the Event tab in the property past the code below ` in the event procedure of the On Muse Down.
Private Sub FormHeader_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
Dim Handle As Long
X = ReleaseCapture()
Handle = Me.hwnd
X = SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
End Sub
0 Comments