astr=ucase("asdf")
那么astr=ASDF

解决方案 »

  1.   

    '引用 Microsoft Data Formatting Object Libary
    Option Explicit
    Dim WithEvents FmtRMB As StdFormat.StdDataFormat
    Private Sub DataReport_Initialize()
    Dim adoRecordset As New ADODB.Recordset
    adoRecordset.Fields.Append "Fld1", adCurrency, , adFldIsNullable + adFldMayBeNull
    adoRecordset.Fields.Append "Fld2", adBoolean, , adFldIsNullable + adFldMayBeNull
    adoRecordset.Fields.Append "Fld3", adDouble, , adFldIsNullable + adFldMayBeNull
    adoRecordset.Open
    adoRecordset.AddNew Array("fld1", "fld2", "fld3"), Array(576000071000.23, True, 1264343.78)
    adoRecordset.AddNew Array("fld1", "fld2", "fld3"), Array(112346800.2, False, 726376.3245)
    adoRecordset.AddNew Array("fld1", "fld2", "fld3"), Array(1001231.01, True, 634532.23)
    adoRecordset.AddNew Array("fld1", "fld2", "fld3"), Array(1000.23, False, 89758242)
    adoRecordset.AddNew Array("fld1", "fld2", "fld3"), Array(110689324230.2, True, 2326786428#)
    Set Me.DataSource = adoRecordsetMe.Sections.Item("Section1").Controls.Item("Text1").DataField = "fld1"
    Set FmtRMB = New StdFormat.StdDataFormat
    FmtRMB.Type = fmtCustom
    Set Me.Sections.Item("Section1").Controls.Item("Text1").DataFormat = FmtRMBDim FmtBooleanX As New StdFormat.StdDataFormat
    FmtBooleanX.Type = FmtBoolean
    FmtBooleanX.TrueValue = "是"
    FmtBooleanX.FalseValue = "否"
    Me.Sections.Item("Section1").Controls.Item("Text2").DataField = "fld2"
    Set Me.Sections.Item("Section1").Controls.Item("Text2").DataFormat = FmtBooleanXMe.Sections.Item("Section1").Controls.Item("Text3").DataField = "fld3"
    Set Me.Sections.Item("Section1").Controls.Item("Text3").DataFormat = FmtRMB
    End Sub
    Private Sub FmtRMB_Format(ByVal DataValue As StdFormat.StdDataValue)
    DataValue = NtoC(Trim(Str(DataValue)), "圆", "角", "分")
    End Sub
    Private Function NtoC(ByVal sNum As String, Optional ByVal Yuan As String = "美圆", Optional ByVal Jiao As String = "美角", Optional ByVal Fen As String = "美分") As String
    If Val(Trim(sNum)) > 0 Then
       Dim sIntD, sDecD As String
       Dim i, iCount, j, iLength As Integer
       Dim lStartPos As Long
       Dim sBIT(4), sUNIT(3), sCents(2) As String
       sBIT(0) = "" '个
       sBIT(1) = "拾"
       sBIT(2) = "佰"
       sBIT(3) = "仟"
       sUNIT(0) = ""
       sUNIT(1) = "万"
       sUNIT(2) = "亿"
       sUNIT(3) = "yu"
       sCents(0) = Fen
       sCents(1) = Jiao
       Dim temp As String
       If InStr(Trim(sNum), ".") > 0 Then
          temp = Left(Trim(sNum), InStr(Trim(sNum), ".") - 1)
       Else
          temp = Trim(sNum)
       End If
       iCount = IIf(Len(temp) Mod 4, Len(Trim(temp)) \ 4 + 1, Len(Trim(temp)) \ 4)
       lStartPos = 1
       For i = iCount To 1 Step -1
           If i = iCount And Len(Trim(temp)) Mod 4 <> 0 Then
              iLength = Len(Trim(temp)) Mod 4
           Else
              iLength = 4
           End If
           sIntD = Mid(Trim(temp), lStartPos, iLength)
           For j = 1 To Len(Trim(sIntD))
               If Val(Mid(sIntD, j, 1)) <> 0 Then
                  NtoC = NtoC & Choose(Val(Mid(sIntD, j, 1)), "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖") & sBIT(Len(Trim(sIntD)) - j)
               Else
                  If Val(Mid(sIntD, j + 1, 1)) <> 0 Then
                     NtoC = NtoC & "零"
                  End If
               End If
           Next j
           lStartPos = lStartPos + iLength
           If i < iCount Then
              If (Val(Mid(sIntD, Len(Trim(sIntD)), 1)) <> 0 Or Val(Mid(sIntD, Len(Trim(sIntD)) - 1, 1)) <> 0 Or Val(Mid(sIntD, Len(Trim(sIntD)) - 2, 1)) Or Val(Mid(sIntD, Len(Trim(sIntD)) - 3, 1)) <> 0) Then
                 NtoC = NtoC & sUNIT(i - 1)
              End If
           Else
              NtoC = NtoC & sUNIT(i - 1)
           End If
       Next
       If Len(Trim(NtoC)) > 0 Then
          NtoC = NtoC & Yuan
       End If
       '小数
       If InStr(1, Trim(sNum), ".") <> 0 Then
          sDecD = Right(sNum, Len(Trim(sNum)) - InStr(1, Trim(sNum), "."))
          For i = 1 To Len(Trim(sDecD))
              If Val(Mid(Trim(sDecD), i, 1)) <> 0 Then
                 NtoC = NtoC & Choose(Val(Mid(Trim(sDecD), i, 1)), "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖")
                 NtoC = NtoC & sCents(2 - i)
                 If i >= 2 Then
                    Exit For
                 End If
              Else
                 If Len(Trim(NtoC)) > 0 Then
                    NtoC = NtoC & "零"
                 End If
              End If
          Next i
       Else
          NtoC = NtoC & "整"
       End If
    Else
       NtoC = "零" & Yuan
    End If
    End Function
      

  2.   

    Me.Sections("Section5").Controls("lblGreatMoney").Caption = "大写:" & NumberToGreat(lngTotalMoney) & "圆整" 
    Me.Sections("Section5").Controls("lblTotalPrize").Caption = "¥" & lngTotalMoney & "元"  
    '注 NumberToGreat 就是你写的数字转大写的函数。
      

  3.   

    http://www.playyuer.com 提供例程下载:http://microinfo.top263.net/Zip/FmtDatRpt.zip
      

  4.   

    http://www.playyuer.com 提供例程下载:http://microinfo.top263.net/Zip/FmtDatRpt.zip