Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup Function 1

Status
Not open for further replies.

Terpsfan

Programmer
Dec 8, 2000
954
0
0
US
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<>&quot;&quot;) then
DLookupStr=DLookupStr & &quot; where &quot; & Filter & &quot;;&quot;
end if

end function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top