By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

Access Queries to a single value...

P: n/a
Hi,

I have a query that returns a sum for all values found that match the
criteria.

I am wanting to place this value in a textbox on its own so I can
refer to it elsewhere.

I have used the dlookup function in the control source of the textbox
to do this, however I only seem to get an '#Error' returned.

When i initiate the query manually all is well - it simply returns the
error when it is embedded in the control source of the textbox:

=DLookUp("[Sum Of Sessions]","[2002/2003 Query]","Criteria = n")

Query: 2002/2003 Query
Field in query: Sum Of Sessions

Any help most most welcome

Ta vm
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Open the Immediate Window (Ctrl+G), and enter:
? DLookUp("[Sum Of Sessions]","[2002/2003 Query]","Criteria = n")

Work on that until you get the desired result.
The 3rd argument is probably the issue.
If you really have a field called "Criteria", and the value to find is "n",
try:
? DLookUp("[Sum Of Sessions]","[2002/2003 Query]","Criteria = ""n""")

Explanation of how to build the 3rd argument for DLookup:
http://members.iinet.net.au/~allenbrowne/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Andrew Stanton" <an***********@hotmail.com> wrote in message
news:7f**************************@posting.google.c om...
Hi,

I have a query that returns a sum for all values found that match the
criteria.

I am wanting to place this value in a textbox on its own so I can
refer to it elsewhere.

I have used the dlookup function in the control source of the textbox
to do this, however I only seem to get an '#Error' returned.

When i initiate the query manually all is well - it simply returns the
error when it is embedded in the control source of the textbox:

=DLookUp("[Sum Of Sessions]","[2002/2003 Query]","Criteria = n")

Query: 2002/2003 Query
Field in query: Sum Of Sessions

Any help most most welcome

Ta vm

Nov 13 '05 #2

P: n/a
use DSUM...
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.