Full Version: How To Number The Records In A Report ?
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
mosquito_admin
Hi everybody !

I have a access 2003 DB with one table, for ex. which contains the info about the users and their PCs like this:
|id| name | PC1 | PC2 | PC3 |
|1 | Jack |Asus |Lenovo| HP |
|2 | John |DELL| | |
|3 | Anna | | Asus | |

I have a query which show this information in this way:
| name | PC |
| Jack | Asus |
| Jack |Lenovo|
| Jack | HP |
|John | DELL |
|Anna | Asus |

and respectively we can create a report which will show this info in this way.
But how to add a field in this report which will show the number of the records which the name's not repeat, like this:

|Nr| name | PC |
| 1 | Jack | Asus |
| | Jack |Lenovo|
| | Jack | HP |
| 2 |John | DELL |
| 3 |Anna | Asus |
???

Please help me !!!
mike60smart
Hi
welcome2UA.gif

Looking at your Field Names indicates that you have Repeating Groups

Instead of 1 Table, you need at least 2 tables, probably more.

Structure would be like this:-

tblUser
-UserID - PK Autonumber
-FirstName
-LastNme

tblPC
-PCID - PK - Autonumber
-UserID - Number - FK - (Linked to tblUser by PK)
-PCName


This is the standard 1 to Many Setup which you need

You would then be able to create the Report you need



dblife
When one of your users gets fourth PC do you plan on amending your table structure etc?
Access is relational.
If your db only has one table, you may as well use a spreadsheet.
Spreadsheets generally speaking are for one-to-one relationships and databases for one-to-many or many-to-many relationships.

Interestingly enough, I can see a many-to-many relationship here.. (sorry to contradict mike60smart)

A table for users.
A table for PC's
And a third, junction table to assign a PC to a user with the PC usage/importance/expense level [whatever 1,2 or 3 means]

The point you make about needing to see only one value and all corresponding values stacked under it, can be done at the report stage using 'sorting and grouping'
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.