如果你是窗体的话,可以设置代码private sub controlname_afterupdate()dim conn as new adodb.connectiondim rst as new adodb.recordsetdim strsql as stringset conn=currentproject.connectionstrsql="select 姓名from tablename where 姓名='"&me.controlname&"'"rst.open strsql,conn,adopenkeyset,adlockoptimisticif rst.recordcount=10 thenmsgbox"已经有10个这样的姓名了"end ifrst.closeset conn=nothingend sub