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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup to get three values from a table 1

Status
Not open for further replies.

GNorman

Programmer
Sep 8, 2009
11
US
I've learned to bypass Recordsets by using DLookup when I need to get a value from a field in a table and store it in a variable. If I need to get three fields into three variables from the same table for the same criteria is a trio of back-to-back DLookups the right way or should I crack open a Recordset? I'll be doing the three field lookup multiple times during a data entry session.
I'm leaving work soon so can't check replies until tomorrow.
 
DLookup can only return a single value, if you want to get three you will have to either do three DLookup's or use a recordset.
An alternative approach, depending on your application may be to use a bound form with the three fields on it and retrieve the data from the form recordset in your vba, this way the data entry form can be used for entry/update of the data and you can use this data in your code without additional database access.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top