در ado به توابع درونی اکسس دسترسی ندارین (مثل همین توابع که اسم بردین)
باید براش تابع معادل بنویسین، یک چیزی شبیه زیر:
const sql as string="select first([@fld]) from [@tbl] where (@whr)"
function dlookup(fieldname as string , tablename as string , where as string) as variant
sql=replace(sql , "@fld" , fieldname)
sql=replace(sql , "@tbl" , tablename)
sql=replace(sql , "@whr" , where)
dim conn as new adodb.connection
conn.connectionstring="...."
dim rs as new adodb.recordset
rs.open sql , conn
if rs.eof then
dlookup=null
else
dlookup=rs(0)
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end function
فقط باید error handling بهش اضافه کنین و احتمالا اگر از یک connection در تمام برنامه استفاده میکنین (برای پرهیز از باز و بسته کردن مداوم connection برای هر عملیات) یک تابع جدا برای باز کردن کانکشن مینویسین.