# MS Access report: can the row count of a query be displayed?

**URL:** https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319
**Category:** Factual Questions
**Created:** [April 4, 2006, 9:43pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319 "2006-04-04T21:43:11Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 9:43pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/1 "2006-04-04T21:43:11Z")

</div>

Here’s what I’ve got:

- Table A

- Query A that gives nothing more than the row count of Table A based on certain criteria ( where Column A is NULL). When you open Query A, you get a result set comprising only a single number – one row, one column.

- A report that needs to show the result of Query A (that selfsame single number).

…  
Can this be done? I’ve been striking out all afternoon. Getting a working Query A is easy – making the result of Query A show up in a report has proven impossible so far.

I understand about Bound and Unbound boxes in Access reports, and how to set Data Control Source of a text box. All the obvious methods of doing this are failing. 😕

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:07pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/2 "2006-04-04T22:07:09Z")

</div>

Did you try the wizard? All you have to do is start a report and base it on that query via the wizard drop-down box. If it is taking you more than 30 seconds, you may have gone down the wrong path.

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:11pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/3 "2006-04-04T22:11:42Z")

</div>

I am gussing now that you probably don’t want just a single number on a report. How about a subreport?

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:13pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/4 "2006-04-04T22:13:23Z")

</div>

Subreports:

[http://office.microsoft.com/en-ca/assistance/HA010550931033.aspx](http://office.microsoft.com/en-ca/assistance/HA010550931033.aspx)

---

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 10:15pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/5 "2006-04-04T22:15:05Z")

</div>

> [@Shagnasty](#):
>
> I am gussing now that you probably don’t want just a single number on a report. How about a subreport?

One subreport for each of the 14 queries?

Yeah, I noticed that it didn’t look like Access allowed a single report to pull data from more than one table/query.

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:19pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/6 "2006-04-04T22:19:29Z")

</div>

> [@bordelond](#):
>
> One subreport for each of the 14 queries?
> 
> Yeah, I noticed that it didn’t look like Access allowed a single report to pull data from more than one table/query.

There should be a problem with that many subreports.

You can write SQL for a control box as well you know. You just enter it in the properties as the source. That may work.

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:19pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/7 "2006-04-04T22:19:56Z")

</div>

> [@bordelond](#):
>
> One subreport for each of the 14 queries?
> 
> Yeah, I noticed that it didn’t look like Access allowed a single report to pull data from more than one table/query.

There shouldn’t be a problem with that many subreports.

You can write SQL for a control box as well you know. You just enter it in the properties as the source. That may work.

---

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 10:21pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/8 "2006-04-04T22:21:27Z")

</div>

Probably going to end up making a table out of all those row counts, then reporting from that.

You don’t happen to know how to add in a “dummy column” to a query in Access, do you? So that a column appears in the query result set that doesn’t appear in the query?

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:26pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/9 "2006-04-04T22:26:07Z")

</div>

> [@bordelond](#):
>
> Probably going to end up making a table out of all those row counts, then reporting from that.
> 
> You don’t happen to know how to add in a “dummy column” to a query in Access, do you? So that a column appears in the query result set that doesn’t appear in the query?

Not sure I follow that. It is a little Douglas Adams-ish. You can add anything you want to a query. Just name the column (or let it give you an Expr1 type name. And just put a calculation or even hard text like “FAKE” to appear.

I am serious when I say that you can probably query striaght from the boxes. I will try it in a second.

---

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 10:29pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/10 "2006-04-04T22:29:14Z")

</div>

> [@Shagnasty](#):
>
> Not sure I follow that. It is a little Douglas Adams-ish. You can add anything you want to a query. Just name the column (or let it give you an Expr1 type name. And just put a calculation or even hard text like “FAKE” to appear.

This is exactly what I want … hard text to appear. Not just the name of the column, though … but also a dummy entry in that field.

---

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 10:35pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/11 "2006-04-04T22:35:22Z")

</div>

> [@bordelond](#):
>
> This is exactly what I want … hard text to appear. Not just the name of the column, though … but also a dummy entry in that field.

Figured it out:

SELECT “Hotel Rooms Occupied” as QRY, [1a Hotel Rooms Occupied - All].COUNT  
FROM [1a Hotel Rooms Occupied - All]

yields:

```php
QRY COUNT
-------------------------------------------------------------------
Hotel Rooms Occupied 298

```

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:36pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/12 "2006-04-04T22:36:22Z")

</div>

> [@bordelond](#):
>
> This is exactly what I want … hard text to appear. Not just the name of the column, though … but also a dummy entry in that field.

All you need to do is enter a new field with a field name in the form of:  
Test: “1”

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:40pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/13 "2006-04-04T22:40:22Z")

</div>

It looks like subreports are the easiest way to do what you ant even if there are 14 of them. Just use the subreport tool to drop and drop it in the report and then follow the wizard to link it to a query. You have to play around with the properties a lot to get it to look right.

---

<div class="post-metadata">

### Author: ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)
#### Post date: [April 4, 2006, 10:42pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/14 "2006-04-04T22:42:03Z")

</div>

> [@bordelond](#):
>
> Figured it out:
> 
> SELECT “Hotel Rooms Occupied” as QRY, [1a Hotel Rooms Occupied - All].COUNT  
> FROM [1a Hotel Rooms Occupied - All]
> 
> yields:
> 
> ```php
> QRY COUNT
> -------------------------------------------------------------------
> Hotel Rooms Occupied 298
> 
> ```

You could do a bunch of union queries to get that into something manageable if you want all the results in a list. That would only require one report or a report and a subreport/

---

<div class="post-metadata">

### Author: ![bordelond](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bordelond/32/150_2.png) [@bordelond](https://boards.straightdope.com/u/bordelond)
#### Post date: [April 4, 2006, 10:50pm UTC](https://boards.straightdope.com/t/ms-access-report-can-the-row-count-of-a-query-be-displayed/351319/15 "2006-04-04T22:50:11Z")

</div>

> [@Shagnasty](#):
>
> You could do a bunch of union queries to get that into something manageable if you want all the results in a list. That would only require one report or a report and a subreport/

Yeppity yep. Thanks for your help!
