Result of Count Query in a Text Box

flemmo

Registered User.
Local time
Today, 07:20
Joined
Apr 26, 2006
Messages
69
Hi,

I have a query the counts rows from another query.
I would like to put the result of the count in a text box in a form. The form itself has a different record source to the count query doesn't show in the 'Add Existing Fields' window.

I tried clicking in the text box, then Control Source, then I went into Expression Builder, clicked on 'Queries', then my count query, then '<value>'. This gave me the following:

=[qryCategoriesCount]![CountOfCategoryID]

However, when I run the form I get #Name? as the value.
What am i doing wrong?
 
In the control source of the control

=DLookup("[CountOfCategoryID]","[qryCategoriesCount]")
 
That's great DCrake, thank you.
It does take around 3 seconds to show up in the text box. Is there any way to speed it up a little?

EDIT: Its okay - putting the code into VBScript onopen (form) is much faster.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom