Best way I guess is to use the BeginTrans statement in the first line of your sub
Private Sub MergeRecords(NewID As Integer, OldID As Integer)

In every sub that is called from the above sub use Error handling to trigger a public boolean (f.i. call it bErrorEncountered) if an error was found, at the end of the above sub check what the value of the boolean is, and use CommitTrans if no errors were found or RollBack if there were errors.

VB can handle this quite well.