Option Explicit Dim MyADOXC, MyADOXT Set MyADOXC = CreateObject("ADOX.Catalog") MyADOXC.Create ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='dummy'")'←本当はフルパス入れたほうがいい MyADOXC.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='dummy'" '←これもフルパスのほうが Set MyADOXT = CreateObject("ADOX.Table") MyADOXT.Name = "tbl00" MyADOXT.ParentCatalog = MyADOXC MyADOXT.Properties("Jet OLEDB:Create Link").Value = True MyADOXT.Properties("Jet OLEDB:Link Datasource").Value = "jisho" '←もちろんこれもフルパスのほうが MyADOXT.Properties("Jet OLEDB:Remote Table Name").Value = "tbl00" MyADOXC.Tables.Append MyADOXT Set MyADOXT = Nothing Set MyADOXC = Nothing "dummy"の中身は、"jisho"から引き込んだリンクテーブル"tbl00"
Option Explicit Dim MyStrUK, MyStrJP Dim MyDbCnn, MyRst MyStrUK = InputBox("何か英単語入れてみて") MyStrJP = "" Set MyDbCnn = CreateObject("ADODB.Connection") MyDbCnn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='dummy'") Set MyRst = CreateObject("ADODB.Recordset") MyRst.Open "SELECT fld2 FROM tbl00 WHERE fld1='" & MyStrUK & "'", MyDbCnn If (MyRst.BOF = False) And (MyRst.EOF = False) Then MyStrJP = MyRst.Fields("fld2").Value End If MyRst.Close Set MyRst = Nothing MyDbCnn.Close Set MyDbCnn = Nothing MsgBox MyStrJP, vbOKOnly, MyStrUK