Rendre Access invisible dans la barre des tâche. Problème avec l'appel du second formulaire
Bonjour,
J'ai trouver dans un site "3stone.be" un code intéressant qui permet de rendre la fenêtre Access invisible dans la barre des tâches, je voulais l'appliquer sur ma base de données.
Dans ma base de données (test), j'ai 2 formulaires, Frm1 et Frm2.
Le Frm1 est le formulaire d'accueil et comporte deux (2) boutons.
Commande1 : sur clic, appel le formulaire Frm2
Commande2: sur clic, affiche la fenêtre Access sur la barre des tâches.
Sur chargement du Frm1 j'ai écris le code suivant:
Code:
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
| Option Explicit
'Appel API et constante pour masquage et affichage
Const SW_HIDE = 0 ' Masquer
Const SW_NORMAL = 1 ' Restaurer- afficher
Private Declare Function ShowWindow Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Sub Form_Load()
DoCmd.RunCommand acCmdSizeToFitForm
DoEvents: DoEvents
'Cacher l'application
Dim hWindow As Long
Dim nResult As Long
Dim nCmdShow As Long
hWindow = Application.hWndAccessApp
nCmdShow = SW_HIDE
nResult = ShowWindow(ByVal hWindow, ByVal nCmdShow)
Call ShowWindow(Me.hwnd, SW_NORMAL)
End Sub |
sur clic du Commande2
Code:
1 2 3 4 5 6 7 8 9 10 11
| Private Sub Commande2_Click()
Dim hWindow As Long
Dim nResult As Long
Dim nCmdShow As Long
hWindow = Application.hWndAccessApp
nCmdShow = SW_NORMAL
nResult = ShowWindow(ByVal hWindow, ByVal nCmdShow)
End Sub |
sur clic de la Commande1
Code:
1 2 3 4 5
| Private Sub Commande1_Click()
DoCmd.OpenForm " Frm2"
End Sub |
Tout marche nickel à part l'appel du formulaire Frm2, j'explique: dans le cas fenêtre Access invisible , quand je clique sur Commande1 le formulaire "frm2" s'ouvre mais il reste invisible.
Puis-je svp bénéficier de votre aide ?
Merci d'avance.