DLookup-retrieves only 1st record in query

G

Guest

I'm trying to pull records from a query, into a form. The first record in
the query appears for every record in the form.

My expression is . . .

=DLookUp("[Customs Value and Duty Totals]![SumOfValue]","Customs Value and
Duty Totals","[Customs Entries]![Entry Number]=[Customs Value and Duty
Totals]![Entry Number]")

This expression is working for records I pull from tables, but not from this
query.

Any thoughts?
 
G

Guest

In the control source of a text box in the form where you want the output of
the query to be displayed, try and write something like

=DLookUp("[SumOfValue]","[Insert here the Query Name]","[Entry Number field
name in query]= "& [Entry Number field name in form])

If the is string try
=DLookUp("[SumOfValue]","[Insert here the Query Name]","[Entry Number field
name in query]= '" & [Entry Number field name in form] & "'")
 
G

Guest

Nope . . . not working. I either get an error or totally blank.
--
Thanks,
Theresa


Ofer said:
In the control source of a text box in the form where you want the output of
the query to be displayed, try and write something like

=DLookUp("[SumOfValue]","[Insert here the Query Name]","[Entry Number field
name in query]= "& [Entry Number field name in form])

If the is string try
=DLookUp("[SumOfValue]","[Insert here the Query Name]","[Entry Number field
name in query]= '" & [Entry Number field name in form] & "'")

--
\\// Live Long and Prosper \\//
BS"D


tscelica said:
I'm trying to pull records from a query, into a form. The first record in
the query appears for every record in the form.

My expression is . . .

=DLookUp("[Customs Value and Duty Totals]![SumOfValue]","Customs Value and
Duty Totals","[Customs Entries]![Entry Number]=[Customs Value and Duty
Totals]![Entry Number]")

This expression is working for records I pull from tables, but not from this
query.

Any thoughts?
 
D

Douglas J. Steele

It's probably because of the spaces in the second parameter. If you're going
to insist on using spaces, you need to enclose the name in square brackets:

=DLookUp("[Customs Value and Duty Totals]![SumOfValue]","[Customs Value and
Duty Totals]","[Customs Entries]![Entry Number]=[Customs Value and Duty
Totals]![Entry Number]")
 

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

Top