二、新建模塊,並輸入以下內容
Public Function Udate(mDATE As Date, mYMD As Integer) As String
'用法 Udate(#1/2/2005#, i)
'i=1 貳零零伍
'i=2 零壹
'i=3 零貳
'i=0 貳零零伍年零壹月零貳日
Dim i As Integer, iD As Integer
Dim strDT(2) As String, strS As String
Dim strD(0 To 9) As String * 1
strD(0) = "零"
strD(1) = "壹"
strD(2) = "貳"
strD(3) = "三"
strD(4) = "肆"
strD(5) = "伍"
strD(6) = "陸"
strD(7) = "柒"
strD(8) = "捌"
strD(9) = "玖"
For i = mYMD + (mYMD <> 0) To mYMD + (mYMD <> 0) - (mYMD = 0) * 2
If i = 0 Then
iD = Year(mDATE)
strDT(i) = strD(iD \ 1000) & strD((iD \ 100) Mod 10) & strD((iD \ 10) Mod 10) & strD(iD Mod 10)
Else
If i = 1 Then iD = Month(mDATE) Else iD = Day(mDATE)
If iD > 9 Then strS = "拾" Else strS = ""
strDT(i) = strD(iD \ 10) & strS & strD(iD Mod 10)
If iD > 9 And iD Mod 10 = 0 Then strDT(i) = "零" & Left$(strDT(i), 2)
End If
Next
Select Case mYMD
Case 0
Udate = strDT(0) & "年" & strDT(1) & "月" & strDT(2) & "日"
Case Else
Udate = strDT(mYMD - 1)
End Select
End Function
三、以第一步建的表為基礎新建一個查詢,加入必要的字段。另在一個空白字段寫表達式:“大寫: Udate([出票日期],0)”。保存這個查詢。
四、在原表中錄入將要打印的支票信息,“出票日期”字段必須錄入正確的日期。
五、運行查詢,就會看到有一個大寫的日期字段。有了這個結果,無論設計窗體,還是設計報表,都可以自由引用了。