Oui, il est possible. Essayez le code ci-dessous avec une base de données d'accès qui a 3 champs prénom, nom, email
Enregistrez le fichier en tant que Employees.mdb (vous pouvez utiliser .accdb mais vous devrez changer le nom dans le code) ASSUREZ-VOUS QUE L'ACCÈS LE FICHIER EST DANS LE MÊME DOSSIER QUE L'HTA.
je copiais dans certaines données de www.mockaroo.com pour le tester (je ne suis pas payé pour dire que c'est juste très utile)
Ceci est un exemple très basique, mais il est possible de créer une interface graphique plus agréable dans un HTA que dans Access.
<title>Employee Directory</title>
<head>
<HTA:APPLICATION
ID="EMPDIR"
APPLICATIONNAME="Employee Directory"
SINGLEINSTANCE="YES"
>
<!-- makes the hta run using IE9 otherwise it runs as IE5 or 6. You can change this to edge -->
<meta http-equiv="x-ua-compatible" content="IE=9"/>
<style>
body {font-family:arial; background:#efefef; color:#333}
</style>
<script language="vbscript">
' ///// this creates the connection when the file is first run.
' //// get the current path if the database file is in the same folder as the hta file. if it's not then enter the full path manually below
Set objFSO = CreateObject("Scripting.FileSystemObject")
curDir = objFSO.GetAbsolutePathName(".") & "\"
Dim oCon: Set oCon = CreateObject("ADODB.Connection")
Dim oRs: Set oRs = CreateObject("ADODB.Recordset")
strCon = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq="& curDir & "Employees.mdb;"
oCon.ConnectionString= strCon
sub getEmployeeList
' gets a list of employees based on the value in the searchbox input.
oCon.open
strSQL = "SELECT * FROM Employees WHERE (first_name like '%" & searchbox.value & "%') or (last_name like '%" & searchbox.value & "%')"
Set oRs = oCon.Execute(strSQL)
strHTML = "<table>"
do while not oRs.EOF
strHTML = strHTML & "<tr><td>" & oRs.fields("first_name") & "</td><td>" & oRs.fields("last_name") & "</td><td>" & oRs.fields("email") & "</td></tr>"
oRs.movenext
loop
oCon.close
strHTML = strHTML & "</table>"
divEmployeeList.innerHTML = strHTML
end Sub
</script>
</head>
<body>
<div id="search"><input type="text" id="searchbox" style="font-size:16pt; margin:10px;"/> <input type="button" value="search" name="submitsearch" style="font-size:16pt;" onclick="getEmployeeList" language="vbscript"></div>
<div id="divEmployeeList" style="width:90%; height:300px; overflow-y:scroll; border:solid 1px #666; margin:10px; background:#fff">-</div>
</body>
Editer votre question et poster votre code – Hackoo
Édité avec les captures d'écran – FabFab