Hello,
i've made a programe where i need to add new users, i would like it so that if a user has the same name as someone in mu db, then it will not allow that entry?
Thanks
Homer S
Printable View
Hello,
i've made a programe where i need to add new users, i would like it so that if a user has the same name as someone in mu db, then it will not allow that entry?
Thanks
Homer S
It is of course possible that you could have two users with the same name but...
Run a query against the db for the new user name before you run your insert. If the query comes back with one or more results inform the user that a record already exists.
That's more a database issue than a vb issue. Depending on your db, you could set the name as a primary key (identity in SQL Server, I think), or just disallow duplicate values.
Name as a PK is a bad idea - not really guaranteed to be unique. Doesn't take too big a user list to need two "Smith" entries.
Yeah, but if he disallows duplicates, it works like a primary key anyway.
Hi Homer,
I don't see how you can avoid duplicate names. That is why most businesses identify customers by a unique number.
Perhaps you should use an Autonumber column to cross identify your customer names.
Yea, but deep down, you know you wouldn't do it that way.Quote:
Originally posted by salvelinus
Yeah, but if he disallows duplicates, it works like a primary key anyway.
Yes what you need is IDnumber as the primary key. To filter out you should check their name against their address.
Regards
Hi,
"To filter out you should check their name against their address."
This takes great care as any minor difference in entering an address would result in a mismatch. It is easier to check firstly on Surname then (if a match is found) Forename then (if a match is found) second forename etc then (if a match is found) postecode (Zip Codes to the Yanks) and then (if a match is found) house number/name.:wave:
That's true, but I wouldn't disallow duplicate names, either. Maybe in a role playing game, where you don't want two Merlins or something.Quote:
Originally posted by nemaroller
Yea, but deep down, you know you wouldn't do it that way.
Hello,
Like the guys say if you what to prevent duplicate during data entry you need to create primary key and enforce No duplicates.
But if you what to check your DB for existing Duplicate records try running this Query
Where Value3 – the field that you think has duplicatesCode:SELECT Value1, Value2 FROM TableName WHERE Value3 IN (SELECT Value3 FROM TableName GROUP BY Value3 HAVING COUNT(*) > 1)
Good luck :wave:
Yes, it's a matter of using the English language and I'm not good at it. :) However, the thing is, as I did mentioned about using IDnumber.Quote:
Originally posted by taxes
Hi,
"To filter out you should check their name against their address."
This takes great care as any minor difference in entering an address would result in a mismatch. It is easier to check firstly on Surname then (if a match is found) Forename then (if a match is found) second forename etc then (if a match is found) postecode (Zip Codes to the Yanks) and then (if a match is found) house number/name.:wave: