Page Number Format

  • Thread starter Thread starter Rob Pet
  • Start date Start date
R

Rob Pet

In Access 2003, I want to use the following page number
format- i, ii, iii. Does anybody know how to do this?
 
I googled and found this function that returns the Roman Numeral of an
integer (see below). You can add a text box to your page header or footer
with a control source of:
=FormatRoman([Page])

Paste this function into a new, blank module and save it as basRoman.
' Formats a number as a roman numeral.
' Author: Christian d'Heureuse (www.source-code.biz)
Public Function FormatRoman(ByVal n As Integer) As String
If n = 0 Then FormatRoman = "0": Exit Function
' There is no roman symbol for 0, but we don't want to return an empty
string.
Const r = "IVXLCDM" ' roman symbols
Dim i As Integer: i = Abs(n)
Dim s As String, p As Integer
For p = 1 To 5 Step 2
Dim d As Integer: d = i Mod 10: i = i \ 10
Select Case d ' format a decimal digit
Case 0 To 3: s = String(d, Mid(r, p, 1)) & s
Case 4: s = Mid(r, p, 2) & s
Case 5 To 8: s = Mid(r, p + 1, 1) & String(d - 5, Mid(r, p, 1)) & s
Case 9: s = Mid(r, p, 1) & Mid(r, p + 2, 1) & s
End Select
Next
s = String(i, "M") & s ' format thousands
If n < 0 Then s = "-" & s ' insert sign if negative (non-standard)
FormatRoman = s
End Function
 
Back
Top