HTA形式でMDB検索アプリを作ってみた。
※実質VBScript
参照先はMS-Access(MDB)でクライアント上で実行。
※サーバー不要
<HTML> <HEAD> <SCRIPT LANGUAGE="VBScript"> <!--
Option Explicit Function fncExec() Dim dbRes, tag Dim dbPath, dbe, db, s, CODEs, SQL if frm.CODE.Value="" then WScript.Quit() CODEs = replace(trim(frm.CODE.Value), ";", ",") dbPath = ".\xxxxxx.accdb" Set dbe = CreateObject("DAO.DBEngine.120") Set db = dbe.Workspaces(0).OpenDatabase(dbPath, False) SQL = "select * from zzzzzzzzzzz where CODE in(" & CODEs & ")" Set dbRes = db.OpenRecordset(SQL) If Not dbRes.EOF then s = "<table border=1><tr><th>AAA</th><th>BBB</th></tr>" Do Until dbRes.EOF s = s & "<tr><td>" & dbRes("AAA").Value & "</td><td>" & dbRes("BBB").Value & "</td><tr>" dbRes.movenext loop s = s & "</table>" & SQL Else s = s & "Not Found" End If objList.innerHTML = s db.Close Set db = Nothing Set dbe = Nothing End Function
--> </SCRIPT> </HEAD> <BODY> <FORM ID="frm"> CODE <INPUT ID="CODE" TYPE="TEXT" SIZE=30> <INPUT ID="EXEC" TYPE="BUTTON" VALUE="Go!" onClick="fncExec()"> </FORM> <DIV ID="objList"></DIV> <INPUT TYPE="BUTTON" VALUE="Close" onClick="window.close()"> </BODY> </HTML>