More than one field results in DLookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

I want to fetch values of two fields using DLookup, can someone help me?

Something like DLookup("date_opened, date_closed","tablename","whereclause")

I have two separate DLookup statements working for each of the fields
date_opened=DLookup("date_opened","tablename","whereclause")
date_closed=DLookup("date_closed","tablename","whereclause")

or if there is another solution, please let me know.

Thank you,
-Me
 
DLookup will only return one value. Is there some reason you need it to
return two? Your sample using two lines is the usual way to use it. If you
want to retireve two fields with one table call, you could use a recordset
object, but it seems like overkill.

Barry
 
aryDates = Split(DLookup("[date_opened] & Chr(124) &
[date_closed]","tablename","whereclause"), "|")

Now, aryDates(0) will contain date_opened and
arDates(1) will contain date_closed
 
You are correct that DLookup returns only one value; however, that value can
be a concatenation of values from multiple fields.
 
Thank you Klatuu, awesome!!! It works for me.

-Me


Klatuu said:
aryDates = Split(DLookup("[date_opened] & Chr(124) &
[date_closed]","tablename","whereclause"), "|")

Now, aryDates(0) will contain date_opened and
arDates(1) will contain date_closed

Me said:
Hello!

I want to fetch values of two fields using DLookup, can someone help me?

Something like DLookup("date_opened, date_closed","tablename","whereclause")

I have two separate DLookup statements working for each of the fields
date_opened=DLookup("date_opened","tablename","whereclause")
date_closed=DLookup("date_closed","tablename","whereclause")

or if there is another solution, please let me know.

Thank you,
-Me
 
Hi Bary,

You have a valid question, I need two, 'cause I am checking if the date is
in certain range ...

Thank you for your time!
-Me
 
Douglas,

Thank you for taking time to answer my question, this solutions works for me.
-Me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top