Click here to Skip to main content
15,843,149 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have a user-form created using linked to an access database. i have a column header named "PV Numbers". i would like to know how i can prevent users from duplicating the PV Numbers.

What I have tried:

The code am currently using is "GBCPVRBindingSource.AddNew"
Posted
Updated 8-Feb-17 6:41am
v2

Every table in a database must have a primary key[^] and that is what you are looking for.
Learn more: SQL PRIMARY KEY Constraint[^]
 
Share this answer
 
v2
As Peter said, "Primary key" is the way.
You need to learn better SQL.
SQL Tutorial[^]
W3Schools Online Web Tutorials[^]
 
Share this answer
 
Comments
Kobby Adom 8-Feb-17 11:56am    
forgive me if i come across as naive cos as i said a m really, really new to VB. But my connection to the access database is not through SQL. Its a simple access connection. The whole code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
GBCPVRBindingSource.AddNew()
End Sub
Patrice T 8-Feb-17 12:13pm    
Access is an SQL server and 'primary ley" is on server side setting for a columns of the table.
Kobby Adom 8-Feb-17 12:44pm    
Thanks ppolymorphe. i have been able to get the PV Number to be the primary key through my VB Express Dataset page. I hope it will do the trick for me and prevent duplication of PV Numbers?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900