dlookup in excel vba.... (1 Viewer)

sal21

Registered User.
Local time
Today, 00:04
Joined
Apr 16, 2004
Messages
19
Assuming i have this mdb:
http://www.mytempdir.com/548579

and a sheet TEST where into A2 is:OI14006 is possible to use the table into mdb to return in B2: GERVASIO CRISTOFARO
IN effect i would want to use all in vba for excel.

this is a part of code i have maked, boh?:

Sub test()
Dim cn As Object, rs As Object
Dim myReturn As Long
Const dbfullname As String = "c:\DATA\user.mdb"

Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" _
& dbfullname & ";" 'Create DB connection

Set rs = CreateObject("ADODB.Recordset")
With rs

''''
peraps here the code for matching?

''''
If Not .EOF Then Let myReturn = .fields(0)
.Close: Set rs = Nothing
End With

cn.Close: Set cn = Nothing

End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom