Bonjour,
j'ai un soucis avec l'affichage des rapports.
Je n'arrive pas à savoir pourquoi, mais les rapports lancés par l'instruction
DoCmd.OpenReport Me.OpenArgs, acViewPreview, , stFiltre, acWindowNormal, "NoClose"
s'ouvrent en tout petit.
il suffit d'agrandir la fenêtre, mais c'est pénible car c'est systématique.
Le truc bizarre c'est que ça ne le fait pas dans un mode que j'ai appelé "debug". Dans le mode non debug, pour les utilisateurs normaux je n'affiche pas le cadre Access, juste le formulaire.
Le mystère est dans le code ci-dessous, à priori car en mettant en commentaire l'instruction en rouge je n'ai plus le problème.
J'ai récupéré ce code sur internet, j'aurais été bien incapable de l'écrire moi-même ;-) mais je ne comprends pas l'effet de bord sur les reports et uniquement ça.
Avez-vous une lumière pour moi ?
Merci d'avance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| If gModeDebug Then
Me.ModeDebug.Visible = True 'affiche le logo du mode Debug
Me.ShortcutMenu = True
' le masque le bouton sortir car il fait la même chose que fermer le formulaire si on est pas en débug
' alors qu'en début les 2 sont visibles
Me.Sortir.Visible = True
Me.FERMER.Visible = True
Else
' cette méthode va masquer la fenêtre access pour ne laisser que le formulaire
'DoCmd.RunCommand acCmdAppMinimize
FenetreModale Me
' le masque le bouton sortir car il fait la même chose que fermer le formulaire si on est pas en débug
Me.Sortir.Visible = False
Me.FERMER.Visible = True
End If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Option Compare Database
Option Explicit
'Déclaration API
Const SW_HIDE = 0 'Hide the window.
Const SW_MAXIMIZE = 3 'Maximize the window.
Const SW_MINIMIZE = 6 'Minimize the window.
Const SW_RESTORE = 9 'Restore the window (not maximized nor minimized).
Const SW_SHOW = 5 'Show the window.
Const SW_SHOWMAXIMIZED = 3 'Show the window maximized.
Const SW_SHOWMINIMIZED = 2 'Show the window minimized.
Const SW_SHOWMINNOACTIVE = 7 'Show the window minimized but do not activate it.
Const SW_SHOWNA = 8 'Show the window in its current state but do not activate it.
Const SW_SHOWNOACTIVATE = 4 'Show the window in its most recent size and position but do not activate it.
Const SW_SHOWNORMAL = 1 'Show the window and activate it (as usual).
Public Declare Function ShowWindow Lib "User32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
'minimise la fenetre access et active le formulaire
Function FenetreModale(pForm As Form)
ShowWindow Application.hWndAccessApp, SW_SHOW
ShowWindow pForm.hWnd, SW_SHOWNORMAL
ShowWindow Application.hWndAccessApp, SW_SHOWMINNOACTIVE
End Function
'minimise la fenetre access et active le formulaire
Function FenetreNotModale(pForm As Form)
ShowWindow Application.hWndAccessApp, SW_MAXIMIZE
ShowWindow pForm.hWnd, SW_RESTORE
ShowWindow Application.hWndAccessApp, SW_SHOWMAXIMIZED
End Function |
Partager