473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Print a record number in access report

Hi experts! (Waiting for your reply)
I want to print serial number or record number in access report while this field is not included in any table. Please help me
Feb 1 '08 #1
8 7013
JustJim
407 Expert 256MB
Hi experts! (Waiting for your reply)
I want to print serial number or record number in access report while this field is not included in any table. Please help me
Hi and welcome to The Scripts,

If a serial number is not included in the table then you can't produce it at all. If you base your report on a recordset or query which is ordered in some way, then you can print the ordinal number of the record within the recordset or query.

It all depends on whether you want this number to be absolutely associated with this record or just for reference purposes within the report.

Let us have more information on your application and we'll see what we can do.

Jim
Feb 1 '08 #2
I want to print record number in report only for reference. How can I do it?
Feb 1 '08 #3
sierra7
446 Expert 256MB
Hi
You can't print something that doesn't exist !

You will have to create something but what is the point of having a 'serial number' not tied to a record ? Next time you print the item may have a different number??

Access reports do not support Line Numbers (at least I can't find)

You had better give more details

S7
Feb 1 '08 #4
Suppose the report is based on query that
SELECT * from employees where age>50

Now I want to print serial number against each selected record in report.

In foxpro a function recno() can do this but in ACCESS i am seeking help.
Feb 1 '08 #5
sierra7
446 Expert 256MB
Suppose the report is based on query that
SELECT * from employees where age>50

Now I want to print serial number against each selected record in report.

In foxpro a function recno() can do this but in ACCESS i am seeking help.
Hi again khursheed
It seems JustJim has your answer at the same time as myself and told you much the same thing. However, if he can get the 'ordinal' number to print in a report then it sound like this is what you really want. I shall wait for his reply because I would like to know more about this too.

Meanwhile, I have been puzzling how you could add line numbers to each record in a report and found that if you have a simple query you could try revising it into an aggregate query and 'count' a unique field;
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT FirstName, LastName, StaffNo, Age, Count(StaffNo) AS CountOfEmp
  3. FROM employees 
  4. GROUP BY FirstName, LastName, StaffNo, Age
  5. HAVING ((Age>50));
  6.  
If [StaffNo] is unique then [CountOfEmp] should be '1' for every record but when you are in Report Design mode you can change the property of the [CountOfEmp] control to be Running Sum = 'Over all' on the Data tab . This then shows in the Report as 1,2,3 etc for each record.

Of course, this will only work if you have a unique field or you could concatonate a combination of fields eg count([FirstName]&[LastName]&[Age]) but is messy and far better to modify your database to have 'serial numbers' that means something.

S7
Feb 4 '08 #6
JustJim
407 Expert 256MB
Hi again khursheed
It seems JustJim has your answer at the same time as myself and told you much the same thing. However, if he can get the 'ordinal' number to print in a report then it sound like this is what you really want. I shall wait for his reply because I would like to know more about this too.

Meanwhile, I have been puzzling how you could add line numbers to each record in a report and found that if you have a simple query you could try revising it into an aggregate query and 'count' a unique field;
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT FirstName, LastName, StaffNo, Age, Count(StaffNo) AS CountOfEmp
  3. FROM employees 
  4. GROUP BY FirstName, LastName, StaffNo, Age
  5. HAVING ((Age>50));
  6.  
If [StaffNo] is unique then [CountOfEmp] should be '1' for every record but when you are in Report Design mode you can change the property of the [CountOfEmp] control to be Running Sum = 'Over all' on the Data tab . This then shows in the Report as 1,2,3 etc for each record.

Of course, this will only work if you have a unique field or you could concatonate a combination of fields eg count([FirstName]&[LastName]&[Age]) but is messy and far better to modify your database to have 'serial numbers' that means something.

S7
Hi guys,

Sorry to keep you holding your breath, but no I don't have a great answer. If it ain't in there, you can't get it out. My "ordinal number" reply was many based on the concept of a recordset (with an index) and the recordset.absoluteposition.

Remember though that a Primary Key is an internal thing. It should be "meaningless" and "invisible to users". This is important because if a record is deleted in a table a PK between, say, 1003 and 1005 may be missing, it it is "meaningless" and "invisible to users" it will not matter. If the PK was visible to users and somehow meaningful they may be tempted to "replace"it. This can cause all sorts of problems!

Do try to read Mary's wonderful explanation of database normalisation (then read it again in about month or so, it takes a while to sink in)

Jim
Feb 7 '08 #7
sierra7
446 Expert 256MB
Hi Jim
That's a pity. I hadn't heard of 'ordinal' numbers and thought I was going to learn something new. It's a long time since I did dBase and RecNo did seem to ring a bell. But I totally agree with your rationale.

When I did some Unbound forms a while ago I had to keep looking up '.AbsolutePosition + 1' to find the record number as the built-in navigation controls don't work and had to write my own.

If you could base an Access report on a Recordset instead of a Query then this might be a possiblity.... I suppose you would have to define the Recordset name Public then you be able to use it as the Record source. .

I have not tried this before (and too busy today) but do you know if it's possible??

S7
Feb 7 '08 #8
Jim Doherty
897 Expert 512MB
Suppose the report is based on query that
SELECT * from employees where age>50

Now I want to print serial number against each selected record in report.

In foxpro a function recno() can do this but in ACCESS i am seeking help.

If all you are wishing to do is print a record number and are not concerned about its ordinal meaning in relation to the data 'other' than showing a sequential number then simply place an unbound textbox in the detail section of the report and set its controlsource to

=[CurrentRecord]

Regards

Jim :)
Feb 7 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: David Allison | last post by:
cmdButton to Print 3 copies of record in Form view ? cmdButton will print 1 but I need 3 copies of the one Form record. -- Dave Allison
8
by: Hank Reed | last post by:
Hello, I have searched through dozens of old responses to this question but have been unable to make it work in my situation. I'm using Access 2000 We have a very old sticker printer on a...
2
by: Paul Mendez | last post by:
I have a form that consists of 150 records and is still growing. there are times when I want to print a certain record of the form, say record 12. I go to file --> print and choose the page number...
3
by: TDIOwa | last post by:
I have a report printing form (Access 97) in which I print different reports from. I have added a combo box that selects the number of copies that I want to print. Here is the rub... The...
3
by: sea | last post by:
I need to be able to print the current form because the form has an embedded object of a .gif file, so report will not work -- does anyone know the way to do this? I tried some code, not sure what...
10
by: MLH | last post by:
If I wanted 2 of each page, could I make them print out 2 of first page, 2 of second page, 2 of third page, 2 of fourth page and 2 of 5th page? Or, do I have to run the openreport method twice...
1
by: lorirobn | last post by:
Hi, I have a report that has a query as its record source. The query picks up records from a table that meet certain criterion. The report then counts how many records there are for each key...
7
by: itm | last post by:
I have a mail out to send to a group of owners with multiple accounts. I want to limit the number of accounts that print on the first page to 20. I want remaining accounts to print on a second...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.