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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Roll-Back Entry if Primary Key Condition Fails

Status
Not open for further replies.

nobull613

Technical User
Jun 6, 2003
76
0
0
US
Good Morning. I have a table where a composite Primary Key is used based upon a unique Date and Location being entered. I want to check the table to make sure the Date and Location haven't been entered already while the user enters data (After Updating the Location).

If they enter the date, then select a location that has that date already entered, I'd like to warn them, roll-back the record they are entering (to avoid the generic Access duplicate PK error) and take them to the record.

I have the check working and the code to take them to the record but am not sure how to clear the record they've entered thus far before taking them to the existing record.

Is there code that will roll the entry back without stopping the code before taking the user to the existing entry?

Thanks, Damon
 
Well that was much easier than I thought it would be. Seems almost too simple.

That seems to do the trick exactly as needed. Thanks BikeToWork!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top