Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jun 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Roman numerals (97 SR2)

    Is there a way to make auto page numbering on a report be in roman numerals????

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Roman numerals (97 SR2)

    I hope this is a very short report. Roman numerals are awfully hard to read once they get up there a ways.

    The problem is that you would have to use code to "calculate" the roman numeral equivalent of the actual page numbers and then insert that into the page footer. That means you would have to create or borrow a function to make that conversion and return the roman numeral string equivalent into the page numbering expression.
    Charlotte

  3. #3
    New Lounger
    Join Date
    Jun 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Roman numerals (97 SR2)

    Yuk. I was hoping there was something like in Word where you can set the number format.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Roman numerals (97 SR2)

    An Access report is nothing like a Word document. Sorry.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Jun 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Roman numerals (97 SR2)

    Bummer. Looks like more coding. <img src=/S/crybaby.gif border=0 alt=crybaby width=15 height=15>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Roman numerals (97 SR2)

    Here is a function to convert a number (integer in the range of 1 - 3999) to a Roman numeral.

    You can use it in the control source of a text box, for instance

    ="Page " & Num2Roman([Page]) & " of " & Num2Roman([Pages])

    The function was adapted from the NeatCd97 sample database made available by Microsoft.

    Function Num2Roman(ByVal n As Integer) As String
    ' Converts a decimal number into a Roman number
    ' Valid input in the range 1-3999
    Const Digits = "IVXLCDM"
    Dim i As Integer, Digit As Integer, Temp As String
    i = 1
    Do While n > 0
    Digit = n Mod 10
    n = n 10
    Select Case Digit
    Case 1
    Temp = Mid(Digits, i, 1) & Temp
    Case 2
    Temp = Mid(Digits, i, 1) & Mid(Digits, i, 1) & Temp
    Case 3
    Temp = Mid(Digits, i, 1) & Mid(Digits, i, 1) & Mid(Digits, i, 1) & Temp
    Case 4
    Temp = Mid(Digits, i, 2) & Temp
    Case 5
    Temp = Mid(Digits, i + 1, 1) & Temp
    Case 6
    Temp = Mid(Digits, i + 1, 1) & Mid(Digits, i, 1) & Temp
    Case 7
    Temp = Mid(Digits, i + 1, 1) & Mid(Digits, i, 1) & Mid(Digits, i, 1) & Temp
    Case 8
    Temp = Mid(Digits, i + 1, 1) & Mid(Digits, i, 1) & Mid(Digits, i, 1) & Mid(Digits, i, 1) & Temp
    Case 9
    Temp = Mid(Digits, i, 1) & Mid(Digits, i + 2, 1) & Temp
    End Select
    i = i + 2
    Loop
    Num2Roman = Temp
    End Function

  7. #7
    New Lounger
    Join Date
    Jun 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Roman numerals (97 SR2)

    Thank you. I will give it a go. I assume it just goes in the module for the report.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Roman numerals (97 SR2)

    If you need the function for just one report, you can put the function in the report module.

    If there is any chance that you will use it in another report, or in a query or form, put the function in a standard module.

  9. #9
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Roman numerals (97 SR2)

    If you have Excel installed, another option for converting numbers to Roman numerals is to use the somewhat obscure Excel ROMAN worksheet function. To use in Access, you have to set a reference to the MS Excel 8.0 Object Library (Excel 97; if using Office 2K, Excel 9.0). Example of use in Access:
    <pre>Public Function GetRomanNumeral(intArabic As Integer)

    Dim xl As New Excel.Application
    GetRomanNumeral = xl.WorksheetFunction.Roman(intArabic)
    'For lower case Roman numerals:
    'GetRomanNumeral = LCase(xl.WorksheetFunction.Roman(intArabic))
    Set xl = Nothing

    End Function</pre>

    This function can be added to any standard module, then can be used in any report or elsewhere. To use for report page footer, add unbound text box with control source set to:
    <pre>="PAGE " & GetRomanNumeral([Page])</pre>

    The ROMAN function converts "Arabic" numbers to Roman format; returns a text string. There is an optional Form argument to specify different Roman numeral formats; for details see the Excel help file for ROMAN_worksheet_function. The default is "classic" style Roman numerals. Like the function HansV provided, the ROMAN function only works with numbers up to 3999. So if your report is 4000 pages or longer you'll get an error.

    HTH

  10. #10
    New Lounger
    Join Date
    Jun 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Roman numerals (97 SR2)

    If this part of the report has more than 4000 pages it won't be the only thing gettiong errors. The keyboard might get an axe through it. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  11. #11
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: Roman numerals (97 SR2)

    An oldie, but a goodie ... Thanks again for your post. It was exaqctly what I needed

    Marty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •