Avatar of Saichand
Saichand
 asked on

DLookup to show multiple records on continuous form

Hi,

i am using the dlookup function in a text box and its giving me a one value. Can someone help me to modify the function which would give the result as multiple values.

attached is a copy of the database..


test1.mdb
Microsoft AccessVB Script

Avatar of undefined
Last Comment
Saichand

8/22/2022 - Mon
derekkromm

DLookup can only return a single value.

From Microsoft's website (http://support.microsoft.com/kb/208786):
The DLookup() function returns one value from a single field even if more than one record satisfies the criteria. If no record satisfies the criteria, or if the domain contains no records, DLookup() returns a Null.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Try this expression:

=DLookUp("Account","Query1","[State]=" & Chr(34) & [cmbmstate] & " and [juris]= " & Chr(34) & [cmbmjuris] & Chr(34))

mx
Saichand

ASKER
Do you know or have any custom function?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Saichand

ASKER
i was reading through the below link and the code wasnt working.

https://www.experts-exchange.com/questions/23375131/DLookup-with-multiple-records.html

DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Also ... how do you get your form to populate with data ?

mx
Saichand

ASKER
i didnt get your question DatabaseMX
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

When the form opens, no records are showing.  What are the steps to get records showing ?

mx
Saichand

ASKER
select the state and jurisdiction in the drop down..
Bitsqueezer

Hi,

you can of course use a recordset and assemble the wanted account numbers to insert it into a textbox. See the attached file for that.
test1.zip
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
Bitsqueezer

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Saichand

ASKER
Not a complete answer i was looking for... but suggestion did help