財(cái)務(wù)人員都知道,轉(zhuǎn)賬支票的出票日期是需要大寫(xiě)的。如果用手寫(xiě),當(dāng)然可以直接填寫(xiě)成大寫(xiě),但如果設(shè)計(jì)專(zhuān)用軟件進(jìn)行套打,每張支票都在固定位置填寫(xiě)大寫(xiě)會(huì)很麻煩,也沒(méi)有必要。這里僅以access2007設(shè)計(jì)為例,給這方面的愛(ài)好者提供一個(gè)思路。
一、先設(shè)計(jì)一個(gè)access2007表,加入轉(zhuǎn)賬支票可能需要的字段,比如付款人名稱(chēng)、付款人賬號(hào)、收款人名稱(chēng)、付款金額、出票日期等等。其中的“出票日期”設(shè)成“日期”類(lèi)型,默認(rèn)值可以設(shè)成“date()”(即當(dāng)天日期)。表設(shè)計(jì)好后命名保存?zhèn)溆谩?/P>
二、新建模塊,并輸入以下內(nèi)容
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
三、以第一步建的表為基礎(chǔ)新建一個(gè)查詢(xún),加入必要的字段。另在一個(gè)空白字段寫(xiě)表達(dá)式:“大寫(xiě): udate([出票日期],0)”。保存這個(gè)查詢(xún)。
四、在原表中錄入將要打印的支票信息,“出票日期”字段必須錄入正確的日期。
五、運(yùn)行查詢(xún),就會(huì)看到有一個(gè)大寫(xiě)的日期字段。有了這個(gè)結(jié)果,無(wú)論設(shè)計(jì)窗體,還是設(shè)計(jì)報(bào)表,都可以自由引用了。
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄