Bonjour, le but de ma venue ici est de savoir si c'est possible d'ouvrir un formulaire preci d'une base de données access en passant par une interface html.
J'ai deja réussi a ouvrir la base de données en question mai je n'arrive pas a ouvrir une macro (qui ouvre sur un formulaire) qui s'appel "essai" ou bun formulaire précis genre "Frm_gestion".
En farfouillant un peu j'ai découvert que l'on pouvait importer des script vb dans une page html chose que j'ai faite et ensuite rappeler la fonction dans un href....
Mai sla çe ne marche pas...
Quelqu'un pourrait-il m'aider svp...
Voici la fonction vb
et voici ma page html
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 Private Declare Function apiSetForegroundWindow Lib "user32" _ Alias "SetForegroundWindow" _ (ByVal hwnd As Long) _ As Long Private Declare Function apiShowWindow Lib "user32" _ Alias "ShowWindow" _ (ByVal hwnd As Long, _ ByVal nCmdShow As Long) _ As Long Private Const SW_MAXIMIZE = 3 Private Const SW_NORMAL = 1 Function fOpenRemoteForm(strMDB As String, _ strForm As String, _ Optional intView As Variant) _ As Boolean Dim objAccess As Access.Application Dim lngRet As Long On Error GoTo fOpenRemoteForm_Err If IsMissing(intView) Then intView = acViewNormal If Len(Dir(strMDB)) > 0 Then Set objAccess = New Access.Application With objAccess lngRet = apiSetForegroundWindow(.hWndAccessApp) lngRet = apiShowWindow(.hWndAccessApp, SW_MAXIMIZE) 'le premier appel à ShowWindow semble rester sans effet lngRet = apiShowWindow(.hWndAccessApp, SW_MAXIMIZE) .OpenCurrentDatabase strMDB .DoCmd.OpenForm strForm, intView Do While Len(.CurrentDb.Name) > 0 DoEvents Loop End With End If fOpenRemoteForm_Exit: On Error Resume Next objAccess.Quit Set objAccess = Nothing Exit Function fOpenRemoteForm_Err: fOpenRemoteForm = False Select Case err.Number Case 7866: ' MDB ouverte en mode exclusif MsgBox "The database you specified " & vbCrLf & strMDB & _ vbCrLf & "is currently open in exclusive mode. " & vbCrLf _ & vbCrLf & "Please reopen in shared mode and try again", _ vbExclamation + vbOKOnly, "Could not open database." Case 2102: ' Ce formulaire n'existe pas MsgBox "The Form \'" & strForm & _ "\' doesn\'t exist in the Database " _ & vbCrLf & strMDB, _ vbExclamation + vbOKOnly, "Form not found" Case 7952: ' L'utilisateur a fermé la base de données fOpenRemoteForm = True Case Else: MsgBox "Error#: " & err.Number & vbCrLf & err.DESCRIPTION, _ vbCritical + vbOKOnly, "Runtime error" End Select Resume fOpenRemoteForm_Exit End Function
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 <!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <title>Poeppelman Acceuil</title> <link rel="stylesheet" href="style.css"> <script language="javascript"> <!-- function Access() { var wScript = new ActiveXObject("Wscript.Shell" ); wScript.run("file:///V:/DB/BASE%20DE%20DONNEES%20EI/Projet%20Ei.accdb"); return false; } //--> sfHover = function() { var sfEls = document.getElementById("menu").getElementsByTagName("LI"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> <script type="vbscript"> Function fOpenRemoteForm("file:///V:/DB/BASE%20DE%20DONNEES%20EI/Projet%20Ei.accdb","Frm_Gestion") End Function </script> </head> <body> <div id="entete"> <img src="img/PP-logo.jpg" alt="" class="logo"> </div> <ul id="menu"> <li> <a href="index.html">accueil</a> </li> <li> <a href="#">Bases de données</a> <ul> <!--<li><a href="#"onClick="return Access();">Rapports d'injections</a></li>//--> <li><a href="vbscript:fOpenRemoteForm()">Rapports d'injections</a></li> <li><a href="#">inscription</a></li> </ul> </li> <li> <a href="#"onClick="return lancertruc();"style="color:white">Bases de données</a> <ul> <li> <a href="#">photos</a> <ul> <li><a href="#">catégorie 1</a></li> <li><a href="#">catégorie 2</a></li> </ul> </li> <li> <a href="#">vidéos</a> </li> </ul> </li> <li> <a href="#">téléchargements</a> <ul> <li><a href="#">vidéos</a></li> <li><a href="#">musiques</a></li> </ul> </li> <li> <a href="#">plus</a> <ul> <li><a href="#">forum</a></li> <li><a href="#">liens</a></li> <li><a href="#">nous contacter</a></li> <li><a href="#">team</a></li> <li><a href="#">recherche</a></li> </ul> </li> </ul> </body> </html>
La fonction "Access" m'ouvre la bdd mais je n'arrive pas plus loin.... Et si quelqu'un ouquelqu'une a plus simple je suis preneur.....
HELP!!!!
Partager