Dear All,
I have a table with a compound key
I have a form with a button that adds new records each time pressed
Code:
	
	
	
		
If I want to add duplicate values data is added then when I want to move to the next record I get the standard Access error message about index, etc so I have to hit Esc to revert the new record
My question is: how can I set up the code so that if duplicate is added I get a custom msgbox and the new record is not added? (without pressing Esc)
Many thanks
 I have a table with a compound key
I have a form with a button that adds new records each time pressed
Code:
		Code:
	
	
	DoCmd.GoToRecord , , acNewRec
Me!sfr_LineManID.Form!ParticipantID = Me.user
Me!sfr_LineManID.Form!StatusAlloc = "Pending approval"If I want to add duplicate values data is added then when I want to move to the next record I get the standard Access error message about index, etc so I have to hit Esc to revert the new record
My question is: how can I set up the code so that if duplicate is added I get a custom msgbox and the new record is not added? (without pressing Esc)
Many thanks

 
	 
 
		
 
   
 
		