新手求助 望解决呀
本人写一个工资管理程序,里有职工号一字段,在添加里添加新员工,但职工号不能为空,也不能有重复因此本人在保存处写写了以下代码,但怎样运行有重复的他都能通过,请大家帮一帮忙,看一看,帮小弟解决这个问题
if empty(thisform.txt职工号.value)
messagebox("职工号不能为空")
thisform.txt职工号.setfocus()
else
loca all for 职工号=allt(aaa(1))
if found()
messagebox("职工号不能重复")
go bottom
thisform.txt职工号.value=''
thisform.txt职工号.setfocus()
其中上边个aaa(1)本人系这样付值的
dimension aaa(13)
aaa(1)=thisform.txt职工号.value
replace 员工信息.职工号 with aaa(1)
听取人家意见象这样改也不行:
if empty(thisform.txt职工号.value)
messagebox("职工号不能为空")
thisform.txt职工号.setfocus()
else
loca all for 职工号==allt(thisform.txt职工号.value))
if found()
messagebox("职工号不能重复")
go bottom
thisform.txt职工号.value=''
thisform.txt职工号.setfocus()
else
replace 员工信息.职工号 with allt(thisform.txt职工号.value)
endif
endif