Report Numbering

  • Thread starter Thread starter dbl
  • Start date Start date
D

dbl

Hi I have to print several reports each day and each report has to be
numbered, the number follows on from the previous days number.

Is it possible for Access to automatically add the next number to the report
each time the report is opened? and could it then only add the next number
if the date has changed.

If it is possible any help on how to do it would be appreciated.

Thanks Bob
 
dbl said:
Hi I have to print several reports each day and each report has to be
numbered, the number follows on from the previous days number.

Is it possible for Access to automatically add the next number to the report
each time the report is opened? and could it then only add the next number
if the date has changed.


You'll need to save the last number used for a report along
with the date it was used. I suggest a one record table for
this, but you could use custom database or report document
properties if you'd prefer.

The report header's Format event seems like a likely place
to run the code needed to retrieve and, if needed update
that record in the table. Let's assume you're using a table
named ReportNumber with fields RepNum and RepDate.
The code might then look something like this air code:

Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("ReportNumber", dbOpenDynaset)
If rs!RepDate < Date Then
rs.Edit
rs!RepDate = Date
rs!RepNum = rs!RepNum + 1
rs.Update
End If
Me.txtRepNum = rs!RepNum
rs.Close : Set rs = Nothing
Set db = Nothing

where txtRepNum is the name of the text box on the report
that you're using to display the report number.
 
Marshall is now possible to save the report to my "T" drive using the report
number i.e.. save as report 21 then next time save as report 22 and so on? I
have done similar in Excel but I do not know how to do it in Access.
 
dbl said:
Marshall is now possible to save the report to my "T" drive using the report
number i.e.. save as report 21 then next time save as report 22 and so on? I
have done similar in Excel but I do not know how to do it in Access.


Sorry, but I've never had a need to do that, so I'm not
qualified to give you a good answer.

I do know that the first thing you have to decide is the
type of file format you want to save the report in. There
are a lot of choices for this, depending on the version of
Access your using.

I suggest that you do a little research to clarify your
requirements and then start a new thread with this question.
 
Back
Top