Is the ELookUp or DLookUp function can be Brings all the rows ? (1 Viewer)

m00j

New member
Local time
Yesterday, 22:27
Joined
Oct 6, 2009
Messages
6
Is the ELookUp or DLookUp function can be Brings all the rows Equals with Criteria ?
I think it is Possible by Modified the Criteria ,, but i did not know how .. so who is know ? :rolleyes:


plz add example
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:27
Joined
Aug 30, 2003
Messages
36,125
To the best of my knowledge, neither DLookup nor any of it's variants (such as Allen Browne's ELookup) will return more than one record. I think Allen's will handle a multi-value field.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:27
Joined
Jan 20, 2009
Messages
12,852
The whole point of the DLookUp and its variants is to return a single value. DLookUp returns the first matching value. That is the first one it comes across. Don't make any assumptions about the order of the search.

Use a query if you want all matching records.
 

m00j

New member
Local time
Yesterday, 22:27
Joined
Oct 6, 2009
Messages
6
i will be more Specific ,, actuality i need the ELookUp or DLookUp function retrieve all the value . that is i want .

is any way to
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:27
Joined
Aug 30, 2003
Messages
36,125
2 minutes and "i am waiting"? In a word, no.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:27
Joined
Jan 20, 2009
Messages
12,852
i am waiting

No matter how long you wait or how much you want, DLookUp will never return more than one value.

That is: the value in the field specified in the first argument, from the table or query specified in the second argument and the first record that matches the third argument.

It cannot return all the values or all the records.

If you want all the records that match your criteria, you need to use a query or open the recordset in VBA.
 

m00j

New member
Local time
Yesterday, 22:27
Joined
Oct 6, 2009
Messages
6
No matter how long you wait or how much you want, DLookUp will never return more than one value.

That is: the value in the field specified in the first argument, from the table or query specified in the second argument and the first record that matches the third argument.

It cannot return all the values or all the records.

If you want all the records that match your criteria, you need to use a query or open the recordset in VBA.


dear friends ,,

let me asking u by another way ,,
Is there a function that can retrieve all values which are Compatible with Criteria?
 

DCrake

Remembered
Local time
Today, 06:27
Joined
Jun 8, 2005
Messages
8,632
Can you provide an example of what you are actually trying to achieve?

David
 

m00j

New member
Local time
Yesterday, 22:27
Joined
Oct 6, 2009
Messages
6
Can you provide an example of what you are actually trying to achieve?

David

hi Mr.David
really i am Happy Because your enjoying my add :) and i am feeling your Nobility ,,

the example what i need in the attach file.
Reality i am Succeeded but with Trick non Acceptable Because i use SubReport and i am think is available other way better my Solution.
thanx
 

Attachments

  • Example1.mdb
    360 KB · Views: 270
Last edited:

ChrisO

Registered User.
Local time
Today, 15:27
Joined
Apr 30, 2003
Messages
3,202
The DLookup function only returns one value.
However, the DLookup function can return more than one field from the same record.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:27
Joined
Jan 20, 2009
Messages
12,852
The DLookup function only returns one value.
However, the DLookup function can return more than one field from the same record.

Yes, thankyou for the clarification.
DLookUp can return expressions including multiple fields from the same record.

Code:
DLookUp("field1&field2","table1","table1.somefield=1")

Code:
DLookUp("field1*field2","table1","table1.somefield=1")
 

ChrisO

Registered User.
Local time
Today, 15:27
Joined
Apr 30, 2003
Messages
3,202
Also like this: -
Code:
Sub Test()
    Dim vntResult As Variant
     
    vntResult = DLookup("[Systolic] & '|' & [Diastolic] & '|' & [Pulse]", "tblPressures", "[SampledAt] = #02/08/2009 8:36:52 AM#")
     
    MsgBox "Systolic = " & Split(vntResult, "|")(0) & vbNewLine & _
           "Diastolic = " & Split(vntResult, "|")(1) & vbNewLine & _
           "Pulse = " & Split(vntResult, "|")(2)
 
End Sub
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:27
Joined
Jan 20, 2009
Messages
12,852
That would certainly be better than three separate DLookUps.
You could improve on it by performing the Split once and writing the results to an array from where they would be displayed.

However in such a situation I would be inclined to open a Recordset using the criteria and read the values directly rather than using the DLookUp. Essentially this is the same as the actions taken by the DLookUp function but this technique would work from data queried directly from an SQL Server whereas the DLookUp would not.
 

m00j

New member
Local time
Yesterday, 22:27
Joined
Oct 6, 2009
Messages
6
thanx ChrisO
thanx Galaxiom
really u are generous :cool:
 

Users who are viewing this thread

Top Bottom