Extracting Values from Queries to Reports

  • Thread starter Thread starter Dexsquab
  • Start date Start date
D

Dexsquab

Guest
Hiya,

Relatively new to database development, and unable to find out how to achieve a specific result I am after.

I have a query which successfully searches through a client list and generates sub-totals of various classes. Basically, I have 180 people's details, and they all fall into twelve categories. Now, the query works fine, correctly totalling the groups and reporting them.

What I want to do is manually call the data for each element of the query to a report. Each value in the query is distinct.

For example, this is the layout of the query DC Count.

DC CountOfClient ID
1 7
2 15
3 11
4 38
... ...
12 2

What I wish to do is extract these values, individually, to unbound text boxes on a report. I've been trying something along the lines of:

SELECT [CountOfClient ID] FROM [DC Count] WHERE [DC]=1
and
=SELECT [DC Count].[CountOfClient ID] FROM [DC Count] WHERE [DC Count].DC=1

No idea where I'm going wrong, any help would be most appreciated.
 
Not quite sure what you are after but if you use the Expression Build part on a Query you can pick its name up on a Form in a bound text box. For example, (in a completely different db) Name: [FirstName]+ " " + {LastName] will give you a field Name that you can access in your Form.
 
Ok, here's what I have.

A Query called DC Count, which contains two columns being DC and CountOfClient ID. The DC values range 0 through 12, although the query doesnt care about that, it's just grouping by DC values. The column CountOfClient ID contains the number for the amount of people who fall into the DC category. The DC values are distinct, and the CountOfClient ID column is correctly counting up the DC values.

I want to know to call up a single element of the CountOfClient ID on a report. I've created an unbound text box on a report which I want to hold the data.

Now, I've tried quite a few different options, being:
=SELECT [CountOfClient ID] FROM (DC Count) WHERE [DC]=1
SELECT [CountOfClient ID] FROM [DC Count] WHERE [DC]=1
SELECT [CountOfClient ID] FROM (DC Count) WHERE [DC]=1
=SELECT "[CountOfClient ID]" FROM "[DC Count]" WHERE "[DC]=1"
SELECT [DC Count].[CountOfClient ID] FROM [DC Count] WHERE [DC Count].DC=1
=SELECT [DC Count].[CountOfClient ID] FROM [DC Count] WHERE [DC Count].DC=1

Whenever I use an =, I get a syntax error, if I remove it I get #NAME on the report. All I want the code above to do is extract the DC=1 count direct to an unbound textbox on the report.
 

Users who are viewing this thread

Back
Top Bottom