采用for i=0 to trv.nodes.count-1 t=trv.nodes.key for j=0 to trv.nodes.count-1 if trv.nodes.key=t then msbox "有相同值",vbinformation exit sub end if next next
for i=0 to trv.nodes.count-1 if trv.nodes.item(i).key=Txtcp.Text then '如果区分大小写,此处应加lcase或ucase函数 msgbox "已经存在" & txtcp.text exit function endif next i如果你在数据库里有保存关键字的话,可以用sql直接到数据库里面查找是否有相同记录
t=trv.nodes.key
for j=0 to trv.nodes.count-1
if trv.nodes.key=t then
msbox "有相同值",vbinformation
exit sub
end if
next
next
if trv.nodes.item(i).key=Txtcp.Text then '如果区分大小写,此处应加lcase或ucase函数
msgbox "已经存在" & txtcp.text
exit function
endif
next i如果你在数据库里有保存关键字的话,可以用sql直接到数据库里面查找是否有相同记录