Solved MS Access Navigationform moveable (1 Viewer)

skdn71

New member
Local time
Today, 19:41
Joined
Jul 23, 2023
Messages
19
Hello
Could you please help how to make Navgationform moveable
I Try below VBA :

is not working

Thank
Code:
Option Compare Database

Option Explicit
#If Win64 Then
Private Declare PtrSafe Function ReleaseCapture Lib "user32" () As Long
#Else
Private Declare Function ReleaseCapture Lib "user32" () As Long
#End If
#If Win64 Then
Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" ( _
            ByVal hwnd As LongPtr, _
                ByVal wMsg As Long, _
                    ByVal wParam As LongPtr, _
                        lParam As Any) As LongPtr
#Else
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
                            ByVal hWnd As Long, _
                                ByVal wMsg As Long, _
                                    ByVal wParam As Long, _
                                        lParam As Any) As Long


#End If
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2

Public Function fDragWindow(frm As Access.Form)

    With frm
       
        ReleaseCapture
        SendMessage .hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
   
    End With

End Function



'on navigation form

Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
fDragWindow Me
End Sub
you
 

Attachments

  • Produc.accdb
    4.2 MB · Views: 29
  • Navigationform.jpg
    Navigationform.jpg
    176.4 KB · Views: 27
Last edited:

isladogs

MVP / VIP
Local time
Today, 18:41
Joined
Jan 14, 2017
Messages
18,241
If you upload a database, it is a bad idea to lock it down.
That may be why 15 people before me had downloaded this & not responded
It looks to me that you don't understand the APIs that you have used in several modules.
If you had, I doubt you would be asking this question

You cannot move your form because it is maximized .
First of all you are using tabbed documents display
Secondly are using DoCmd.Maximize in Form_Load

I've changed it to use Overlapping Windows display & DoCmd.Restore in Form_Load
It is now movable by holding down the mouse on a blank area on the detail section
 

Attachments

  • Produc_CR.accdb
    596 KB · Views: 25

Users who are viewing this thread

Top Bottom