dlookup function to retrieve query results

R32chaos

Registered User.
Local time
Today, 15:02
Joined
Mar 19, 2007
Messages
43
I have a totals query, "qrsChildren" in which I have only three fields:
1-Lastname (is set to count, and returns the correct totals titled: countofLasName...this field is set to show)
2-facility# (in criteria; forms![frmFosterFamily]![facility#]...this field is not set to show)
3-current (is set to "yes"...this field is not set to show)

When run, the query works fine and shows me a total count of lastname. I want that number to show on a form. I have used the dlookup function in a non-bound control field as follows but it does not work:

dlookup("[lastname]","qrsChildren")
I have tried dsum("[lastname]","qrsChildren") also...nothing works

Any help will be very much appreciated...Thank you!
 
Just a guess...did you use the equal sign?

=dlookup("[lastname]","qrsChildren")

Regards,
Tim
 
Wouldn't it be:

=dlookup("[countofLasName]","qrsChildren")
 
Thank you Pono1 and boblarson..."=" sign was there and I had also tried sumoflastname.

It has however worked...what I ended up doing is to take out the sum function from the query. Then I simply changed the statement to =dcount("[lastname]","qrsChildren") and VOILA! it worked :D

So when pulling in a query's value into a field within a form, I guess we have to consider dsum, dcount, and dlookup.

Thank you for your input!
 
I've used a Dlookup with a count in a query before so I know it works. Without seeing the actual db I can't say why you couldn't get it to work.
 

Users who are viewing this thread

Back
Top Bottom