Duplication Verification

Hi,

How can I check the duplication of data in a particular field when trying to update a database.The database I am using is access.
It's in VB5
prasugAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

prasugAuthor Commented:
I am not aN EXPERT NOW.
0
InteqamCommented:
just do a little select distinct statement and compare the resulting recordset count with the original count ( i suppose you don't have Null values ) they must be the same if there is no duplications.
0
prasugAuthor Commented:
This answer is sufficient.when you try to update a field in the database we have to know whether that particular data is already exisiting in the database or not? what is the code for checking the same.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

InteqamCommented:
try the find method in the record set
or the count of the select where statement
0
prasugAuthor Commented:
The above answer is not sufficient for me.
I am not an expert.CAn u please describe it with a sample codes.
when you try to update a field in the
                database we have to know whether that particular data is already
                exisiting in the database or not? what is the code for checking the
                same.
0
JShepherdCommented:
Is there a primary key on the field that you want to check?
0
InteqamCommented:
for 15 points
you are dreaming
0
GustavoValdesCommented:
If you have a table named Employees with three fields Code, FirstName, LastName. If you want to know if there is a field that already has the Code '001' then you must do a select, this way:

 SELECT COUNT(*) AS Regs
 FROM Employees
 WHERE Code = '001'

Of course you could make this statement with some string concatenations from VB or you could make a parametrized query to send just the code.

Then if the only field (in the only record) this resultset will have has a value different from 0 then you can be sure there is at least one record with the same code, obviously, if you have a unique index there is only one record with this code.

Hope it helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.