roman numbers

  • Thread starter Thread starter cshow
  • Start date Start date
C

cshow

How can I sert roman numbers( i,ii,iii instead of regular numbers (1,2, 3)
on my access report

Also can I grab a page number off one report and put it on another report
and increment it by any number.

thanks
 
cshow said:
How can I sert roman numbers( i,ii,iii instead of regular numbers (1,2, 3)
on my access report

Also can I grab a page number off one report and put it on another report
and increment it by any number.


Here's a function that converts numbers to roman numerals.

Function RomanNum(ByVal intValue As Integer, Optional
booUpper As Boolean = True) As String
Dim strRNs As Variant: strRNs = Array("I", "V", "X", "L",
"C", "D", "M", "Y", "Z")
Dim intDigit As Integer, intNum As Integer, i As Integer

If intValue < 0 Then RomanNum = "NEGATIVE": Exit
Function
intNum = intValue

For i = 0 To UBound(strRNs) - 2 Step 2
intDigit = intNum Mod 10
Select Case intDigit
Case 1 To 3
RomanNum = String(intDigit Mod 5, strRNs(i)) &
RomanNum
Case 4
RomanNum = strRNs(i) & strRNs(i + 1) & RomanNum
Case 5 To 8
RomanNum = strRNs(i + 1) & String(intDigit Mod
5, strRNs(i)) & RomanNum
Case 9
RomanNum = strRNs(i) & strRNs(i + 2) & RomanNum
End Select
intNum = intNum \ 10
If intNum = 0 Then Exit For
Next i

If booUpper = False Then RomanNum = LCase(RomanNum)
End Function

You can call the function from a text box expression:

=RomanNum([yournumberfield], False)
 
Thanks, Marsh. That worked like a charm

Marshall Barton said:
cshow said:
How can I sert roman numbers( i,ii,iii instead of regular numbers (1,2, 3)
on my access report

Also can I grab a page number off one report and put it on another report
and increment it by any number.


Here's a function that converts numbers to roman numerals.

Function RomanNum(ByVal intValue As Integer, Optional
booUpper As Boolean = True) As String
Dim strRNs As Variant: strRNs = Array("I", "V", "X", "L",
"C", "D", "M", "Y", "Z")
Dim intDigit As Integer, intNum As Integer, i As Integer

If intValue < 0 Then RomanNum = "NEGATIVE": Exit
Function
intNum = intValue

For i = 0 To UBound(strRNs) - 2 Step 2
intDigit = intNum Mod 10
Select Case intDigit
Case 1 To 3
RomanNum = String(intDigit Mod 5, strRNs(i)) &
RomanNum
Case 4
RomanNum = strRNs(i) & strRNs(i + 1) & RomanNum
Case 5 To 8
RomanNum = strRNs(i + 1) & String(intDigit Mod
5, strRNs(i)) & RomanNum
Case 9
RomanNum = strRNs(i) & strRNs(i + 2) & RomanNum
End Select
intNum = intNum \ 10
If intNum = 0 Then Exit For
Next i

If booUpper = False Then RomanNum = LCase(RomanNum)
End Function

You can call the function from a text box expression:

=RomanNum([yournumberfield], False)
 
Back
Top