Re: Unique Field Verification



you can also set the field as unique in the db then try the insert, if
there's an error ask the user to chose a new name, eg
on error resume next
' try the insert
if err.number <> 0 then
' name exists, get user to chose a new one
else
' success - name doesn't exist
end if
on error goto 0

The advantage is that you're only hitting the database once rather than
twice. Obviously this only applies to access, in sql server you'd use a
stored procedure to do the insert and return success or failure as an output
param.

Cheers,
Jon

"Stefan B Rusynko" <sbr_enjoy@xxxxxxxxxxx> wrote in message
news:u$9AqCGQHHA.1248@xxxxxxxxxxxxxxxxxxxxxxx
The way to check is to query the DB for that new user name and that email
address before you write the new ones to the DB
If you get a EOF the new ones were not a dupe
If you get a hit the new ones are dupes

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


"frontpagecustoms.com" <mark@xxxxxxxx> wrote in message
news:1169695966.446238.105510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Does anyone have a script or code that will verify a user name or email
| address is unique in a database entry form?
|




.



Relevant Pages

  • Re: Unique Field Verification
    ... , no stored procedures required, and it's a single ... 'success - address has been inserted ... If you get a EOF the new ones were not a dupe ... | address is unique in a database entry form? ...
    (microsoft.public.frontpage.programming)
  • Re: Just another OS X crash...
    ... M$ chose to not even give the user a chance (and I'm sure research showed enough people preferred 'a less good OS' to the other option...A clean slate. ... it may be too late to find another road and avoid the "bridge out" (even if they can provide a better/good enough non-Unix OS. ... Ultimately the leadership of any organization has the character for long term success or is happy with a good week at the crap tables. ... No only is 'postpone' not good, ...
    (comp.sys.mac.advocacy)
  • Re: Calzagie Lacy Predictions
    ... and caring, a failure is no more than part of experience on the road ... to success. ... The road I chose is littered with much experience. ...
    (rec.sport.boxing)
  • Re: Stage presence - or lack of?
    ... Len - I would really like to know who the two baritones you referred to ... are...and I am curious as to why you chose not to mention their names. ... success, though often seeming more superficial than intense. ...
    (rec.music.opera)
  • Re: Obesity May Shrink U.S. Lifespan
    ... He gave you resources for the success. ... chose not to believe them. ... Nothing will convince you it works anyway, ...
    (sci.med)

Loading