473,406 Members | 2,549 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,406 software developers and data experts.

Check & Forbid Duplicate Data in A Month

I have a census database where I would like to forbid user insert a new census data if the same ProductID already in the database in the same month.

Thanks for your help. :D
Sep 13 '12 #1

✓ answered by Seth Schrock

Create a query that has the criteria of the current Month and the ProductID. Then, do a DCount() of that query and test the value to see if it is greater than 0 using an If/Then/Else statement. If the value is greater than 0, then set Cancel = True. This will stop the form from going to the next record and the form from closing and the data from saving. You can also create a message box telling the user what happened and what they need to do.

2 1601
Seth Schrock
2,965 Expert 2GB
Create a query that has the criteria of the current Month and the ProductID. Then, do a DCount() of that query and test the value to see if it is greater than 0 using an If/Then/Else statement. If the value is greater than 0, then set Cancel = True. This will stop the form from going to the next record and the form from closing and the data from saving. You can also create a message box telling the user what happened and what they need to do.
Sep 13 '12 #2
Thank you so much Seth... I will try your solutions. :D
Sep 13 '12 #3

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

Similar topics

1
by: Charles | last post by:
Hi MS Access & MS SQL Server Gurus ! I am trying to delete duplicate data from a LINKED SQL Server 2000 table (LinkedTable) and insert the result into a local (in Access) table. The following...
3
by: craig.brenizer | last post by:
I have a table of data that has duplicate values in the pagenumber field. How can I combine the data so that the page numbers of duplicate part numbers are on one record for that part number? ...
0
by: tom | last post by:
Hi, I have a datagrid which display the data like this: bookName Author ------------------ book1 Bob book1 Nancy book2 Tim ------------------
2
by: Mike Charney | last post by:
I have a temp table that has data I am inserting into a SQL DB table. There is a column in both tables called PAT_ID. I need to check the SQL table against the temp table for duplicate data in...
4
by: sandi | last post by:
hi there i have fields name called .. PAF (text) , PNo (Number ) , LastName (Text) 2006/214/2 , 220101 , Winne 2006/321/3, 521496 , Joe 2006/321/1 , 521496 , Joe 2006/541/4 , 521496 ,...
1
by: anjanareddy | last post by:
Hai, i am unable to inserting duplicate data into UNIQUE index column, Is there any other process, to insert duplicate data into UNIQUE index column? plz let me know.. Thanks & Regards...
1
by: oaklander | last post by:
I would like to make sure there are no duplicate data entries in my Oracle 9i table (called MainTable) which has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2...
3
by: killswitch101 | last post by:
I need to get all of the non-duplicate data out of 2 tables (ci and hi) i can't seem to work it out i think i need to use the minus command but that will only display the data for 1 table can...
4
by: liverbarry | last post by:
I have a table coalled tAddress, which includes fields street, Suburb, city, home Phone I have another table called tNOK (next of Kin) and the same address fields, using subforms to enter data...
1
by: AccessBeetle | last post by:
I am working with SQL server 2005 backend and Access 2003 frond end. I have a form bound to a table tblReportDetails. There are several(5) tabs on the same form. Each tab has its own subform. Every...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.