| View previous topic :: View next topic |
| Author |
Message |
Mitesh2004 Freshman
Joined: 26 Jan 2004 Posts: 43
|
Posted: Feb 17th, 2004 07:54 AM Post subject: Making sure a field is kept unique |
|
|
Hi,
I am using ADO to connect to my database. I have a form that allows the users to enter in details of events into a database. I want to make it so that the same EventName is not duplicated in any of the records.
I am guessing that i will have to do a search in my database to make sure that none of the other events have the same EventName. Am i right? If so, how would I do this sort of search in the database?
Your help will be greatly appreciated, Cheers! |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
Mitesh2004 Freshman
Joined: 26 Jan 2004 Posts: 43
|
Posted: Feb 17th, 2004 08:07 AM Post subject: |
|
|
Thanks for that Avis,
I have just tried that and it works from the database point of view. However, when a record of the same EventName as an existing record is attempted to be added, my VB program crashes with an error.
How do i prevent this from happening? Is there any code that i can write for when the 'Add' button is clicked? |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
Mitesh2004 Freshman
Joined: 26 Jan 2004 Posts: 43
|
Posted: Feb 17th, 2004 08:29 AM Post subject: |
|
|
Thanks for this Avis,
But i have been told that it is bad coding practice to use 'GoTo'. Am i correct? or do you think it is ok to use GoTo in this case? |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
|