Hisham
Hisham

Reputation: 455

Assign specific page numbers to ms access report in vba

I have reports in ms access and I have specific startup page number for each report in my DB I want to give that specific start number to report as its first page number and +1 in it for other pages. How can I achieve it I tried doing reseting page number in VBA but I couldn't successfull.

Upvotes: 0

Views: 1068

Answers (1)

Andre
Andre

Reputation: 27644

If each report has a fix starting page number, you can simply change the textbox displaying the page number from

="Page " & [Page]

to

="Page " & [Page] + 19

for a report that should start on page 20.

If you need VBA to determine the starting number, use a Public Function, e.g.

Public Function RepPageStart(RepName As String) As Long

    Select Case RepName
        Case "Report A": RepPageStart = 19
        ' etc
    End Select
    ' or instead Select Case read the number from a table ...

End Function

and on the report:

="Page " & [Page] + RepPageStart([Name])

[Name] returns the report name.

Upvotes: 1

Related Questions