I've used DLookups quite a bit with my Access applications but I haven't seen any documentation for it with either SQL or Visual Basic. Is this essentially a VBA only function? Thanks in advance.
Yes it is only a function in Microsoft Access and I also worried about that. So I write my own function which does the same !!
Here is a way you can use it in your own application by building the right SQL-Statement like your DLookup Function in Access does. Only you have to do is to execute this
String and so you have the DLookup Function 'simulated'.
Public function DLookupStr (Field as string,Tablename as string,optional Filter as string="" as string
DLookupStr="SELECT " & Field & " from " & Tablename
if (Filter<>"" then
DLookupStr=DLookupStr & " where " & Filter & ";"
end if
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.