在添加記錄時,某一個數(shù)據(jù)字段自動生成,就是在其最大值的基礎(chǔ)上加1
首先定義一變量zmax,存放最大值
在表單的refresh事件中輸入以下代碼:
sele nj
i=recn()
calculate max(證書編號) to zmax
if zmax=0
zmax=210922000000
go bottom**激活表
else
go i**激活表
endif
在添加按鈕的click事件中輸入以下代碼:
dodefault()
thisform.pageframe1.page1.txt姓名.setfocus
thisform.pageframe1.page1.txt證書編號.enabled=.f.
thisform.pageframe1.page3.txt證書編號.enabled=.f.
if this.caption='保存'**(保存和添加按鈕為一個按鈕)
thisform.pageframe1.page1.txt證書編號.value=zmax+1
*zmax=zmax+1
*this.refresh()
thisform.refresh() **一定要刷新表單
endif