Solved Error 3022

smtazulislam

Member
Local time
Today, 21:57
Joined
Mar 27, 2020
Messages
808
Hey ! I working with the 1 year this database. Nothing found any error. Today I get this message. Can explain why I see this message ? How to resolve this error.
Also, any tab or Enter for search then get message.

NOTE : There is no Duplicate Data entry in the tables.
1646218278978.png
 
Check the data you're trying to add against your validation and index constraints.
 
Check the data you're trying to add against your validation and index constraints.
Thank you so much Sir, There have 78 tables. Can you talk me have any way to quickly I can find out this record.
 
Thank you so much Sir, There have 78 tables. Can you talk me have any way to quickly I can find out this record.
It should be in the record you're trying to add or change when you get that error.
 
This error only one form. Other all of the form is work properly
I see ...
Can you post a copy of the db with just the form with subforms and required tables/queries.
Just a few (fictitious) records to illustrate the problem
 
First message when search any employee ID.
1646222677668.png


When I click "Debug" then show
1646222731526.png


If I click any tab or try to close. Then get
1646222779323.png
 
Last edited:
try hitting "End" button, then pressing ESC key several times, before changing tabs.
otherwise, upload your db, coz there is no use guessing here.:LOL:
 
I create the new form now. I dont have any way. Lets say why this message come.
Now working okay. but this message. how can resolve this message

EDIT/
my SQL:
SELECT ContractSN([Forms]![frmEmployeeEdit]![txtEmployeeID],[ContractID]) AS SN, tblContracts.ContractID, tblContracts.EmployeeID, tblContracts.ContractType, tblContracts.DateFrom, tblContracts.DateEnd, tblContracts.RenewType, tblContracts.ConState, tblContracts.Note
FROM tblContracts;
 

Attachments

  • Capture9.JPG
    Capture9.JPG
    15.3 KB · Views: 243
What is ContractSN? When asked for a parameter, there is often a misspelling.
For debugging you might want to do this before running the SQL statement.
Debug.print Forms]![frmEmployeeEdit]![txtEmployeeID to ensure there is value
and/or
Debug.print ContractSN([Forms]![frmEmployeeEdit]![txtEmployeeID] to ensure this works as expected.
 
You say in post #12 that you get this error when you try to close the form or click on a tab.

1. Do you have any code that is based on the OnClick event of the tab you would click in that context? If so, what does it do? If it touches any table with an update or an insert, look at that touch.

2. Closing a form forces an automatic update of any dirty form or sub-form. Limiting your search to the the form and its sub-forms, see if any ONE of the involved forms would create a duplicate record. As a possible source of this problem, do ANY of the tables involved in the form and its sub-forms have a primary key or unique index (that isn't the PK) that does NOT have a "Required" constraint on it? My thought is that there might be a zero or null somewhere and the table in question already HAS another record with zero or null, thus leading to the duplicate value.
 
Here's a couple of thoughts

maybe when you go to acNewRec it writes some data to particular fields in the current event, or with the field properties.
And you already have that (half edited) record saved in the database, so this second attempt produces a duplicate.
Show the record selector, and see if the new record immediately shows a pencil (dirty indicator)

Alternatively, maybe somehow you have an autonumber that has become corrupted, and is duplicating.
 

Users who are viewing this thread

Back
Top Bottom