473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How can I prevent an ID from being entered twice in my database?

68
Hi!
Help! I have a 5 digit customer ID (long integer) field in frmClients (reads from tblClients). It is NOT a primary key because not all customers have one. I need to prevent a user from duplicating the ID in the database. I'm thinking I need to put some code in the 'AfterUpdate' on the ID field, but I don't know what the code should be. I've never had to do this before.

I would really appreciate if someone could let me know what that would be. I'm fine just having a message box pop up that says something like "ID already exists in database. Delete Record?"

Thanks a ton!
Apr 24 '07 #1
3 1450
MMcCarthy
14,534 Expert Mod 8TB
Hi!
Help! I have a 5 digit customer ID (long integer) field in frmClients (reads from tblClients). It is NOT a primary key because not all customers have one. I need to prevent a user from duplicating the ID in the database. I'm thinking I need to put some code in the 'AfterUpdate' on the ID field, but I don't know what the code should be. I've never had to do this before.

I would really appreciate if someone could let me know what that would be. I'm fine just having a message box pop up that says something like "ID already exists in database. Delete Record?"

Thanks a ton!
In the table set the Indexed property of the [customer ID] to Yes (No Duplicates)
Apr 24 '07 #2
dk4300
68
In the table set the Indexed property of the [customer ID] to Yes (No Duplicates)

Thank you! I had originally ruled that out, because I wanted the 'Required' field set to "Yes", which means I needed the ID field to default to 0. Then for the customers that didn't have IDs, it was saying that the 0s were dupes.

After taking another look, maybe I'll set 'Required' to "No", the 'Indexed' to Yes (No duplicates), 'Default' to null, and check to see if it's filled in on the Unload property of the form.
Thank you so much for your time!!!
Apr 24 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Thank you! I had originally ruled that out, because I wanted the 'Required' field set to "Yes", which means I needed the ID field to default to 0. Then for the customers that didn't have IDs, it was saying that the 0s were dupes.

After taking another look, maybe I'll set 'Required' to "No", the 'Indexed' to Yes (No duplicates), 'Default' to null, and check to see if it's filled in on the Unload property of the form.
Thank you so much for your time!!!
You're welcome.
Apr 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: entoone | last post by:
I have an html form, that has fields and when the submit button is pressed, the information is transferred to a php file. Which then inserts the data into my sql database. How can I go about...
7
by: John | last post by:
How do I prevent blank data from being entered into a table? For instance, the user fills out a form, but if a field is left blank, then the entire entry won't be filled in. This isn't...
2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
7
by: Douglas | last post by:
I have a frontend and backend database , program.mde and data.mdb on a client PC. How do i prevent them launching the program.mde more than once on a single PC? Somtimes they minizmise the program...
7
by: Nimrod Cohen | last post by:
Hi During the page_load of my Aspx page "http://myMachine/MyWebApp/Quote.aspx" , i write to the response an html that embeds a form with the action pointing out to the same aspx page i.e...
7
by: e_matthes | last post by:
Hello everyone, I've read enough about email validation to know that the only real validation is having a user respond to a confirmation message you've sent them. However, I want to store the...
2
by: eazyone | last post by:
I can prevent a duplicate ID from being entered, but can't figure out how to go to that specific record. I keep getting an error message on: Me.Bookmark = rsc.Bookmark Its not opening and...
0
by: josephkorn | last post by:
Hi all. I have a problem in my website in trying to prevent a user from double submitting the form. I am calling a subroutine from my page_load event that passes in the commandbutton that I want...
5
by: ezra | last post by:
I have created an employee database in MS Access 2003. However, I have now discovered a couple of cases of the same person being entered into the database two or more times (The problem being they...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.