DBApprentice
On Error GoTo AWF *****:
- Local time
- Today, 18:24
- Joined
- Dec 24, 2018
- Messages
- 150
Hey, guys. 
I have a question that is not exactly equal to thousands of threads on the forum - which I have already asked before! - on how to prevent duplicates while ADDING new records to a table/query via form.
I have a form that EDITS the employee information, for instance, and if a super-duper-smart-ass-pesky
user tries to EDIT a given record to providing the same information of another employee on these fields: FIRSTNAME, LASTNAME, COMPANY, POSITION, I would like to spot that and prevent that editing.
Now, this form is also used to add information, I have a big Select Case already in place to detect when the user is in a new record or is editing. However, running some tests I noticed that if I remove this part:
FYI I am using this:
It is possible to EDIT the information so that I can create duplicates.
If I leave the DCOUNT then I can´t EDIT any information because I will get a warning that I am making a duplicate...
I was wondering if I can retrieve any information from the recordset that can tell me the user is EDITING a information and then use that in a select case that can validate it.
Any ideas?

I have a question that is not exactly equal to thousands of threads on the forum - which I have already asked before! - on how to prevent duplicates while ADDING new records to a table/query via form.
I have a form that EDITS the employee information, for instance, and if a super-duper-smart-ass-pesky

Now, this form is also used to add information, I have a big Select Case already in place to detect when the user is in a new record or is editing. However, running some tests I noticed that if I remove this part:
Code:
Case DCount("ObserverID", "qryObserversInfo", "TestName= """ & Me.txtTestName & """ ") > 0
MsgBox "This Observer is already recorded on database." & vbCrLf & vbCrLf & "Please review the information and re-try.", vbCritical + vbOKOnly, "SAVE OPERATION FAILED"
It is possible to EDIT the information so that I can create duplicates.
If I leave the DCOUNT then I can´t EDIT any information because I will get a warning that I am making a duplicate...
Code:
Private Sub Form_Current()
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
Any ideas?
