Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Canceling Addition of Duplicate Record in Data Entry Form 1

Status
Not open for further replies.

mas5

Programmer
Dec 15, 2002
98
US
Hi all! I have a data entry form where the user is adding names, addresses and some other info. If a user adds a last name and first name that already exists I send a message noting that it's a possible duplicate and ask if they want to continue. If they answer no then what I would like to do is cancel the addition of the record and go back to the first field on the form instead of telling them to press the escape key and go back to the first field. I have no problem going back to the first field (I just setfocus on it) but I can't seem to cancel the addition of the record and clear out the fields they've entered as would happen if they press the escape key. I've tried Docmd.CancelEvent and Sendkeys "{esc}", even sendkeys "{esc} {esc}" but it doesn't work. Anyone have any solutions to this problem?

Thanks for your help - MAS
 
Try:
if...your code here for the search then
cancel = true
me.undo
else
Your code to add the record






"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
THANK YOU, THANK YOU, THANK YOU!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top