... sqlString="select top 1 from 工资 where id=trim(txtID.text)" rst.open sqlstring,cn,..... if rst.eof=false then msgbox "员工号重复!",vbokonly,app.title txtid.selstart=0 txtid.sellength=len(txtid.text) txtid.setfocus end if 不知我这样讲合不合你的要求~感觉你都开始做人事管理(大软件吧?),好像问题不能像我理解的吧????
sqlString="select Count(*) from 工资 where id='" & trim(txtID.text) & "'" '如果id是数字型 'sqlString="select Count(*) from 工资 where id=" & val(txtID.text) rst.open sqlstring,cn,..... if rst(0)>=1 then msgbox "员工号重复!",vbokonly,app.title txtid.selstart=0 txtid.sellength=len(txtid.text) txtid.setfocus end if
sqlString="select top 1 from 工资 where id=trim(txtID.text)"
rst.open sqlstring,cn,.....
if rst.eof=false then
msgbox "员工号重复!",vbokonly,app.title
txtid.selstart=0
txtid.sellength=len(txtid.text)
txtid.setfocus
end if
不知我这样讲合不合你的要求~感觉你都开始做人事管理(大软件吧?),好像问题不能像我理解的吧????
sqlString="select Count(*) from 工资 where id='" & trim(txtID.text) & "'"
'如果id是数字型
'sqlString="select Count(*) from 工资 where id=" & val(txtID.text)
rst.open sqlstring,cn,.....
if rst(0)>=1 then
msgbox "员工号重复!",vbokonly,app.title
txtid.selstart=0
txtid.sellength=len(txtid.text)
txtid.setfocus
end if