Check & Forbid Duplicate Data in A Month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yus2aces
    New Member
    • Sep 2012
    • 14

    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
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    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.

    Comment

    • yus2aces
      New Member
      • Sep 2012
      • 14

      #3
      Thank you so much Seth... I will try your solutions. :D

      Comment

      Working...