I am developing an accounting application where a key is given to each transaction. 
for eg: in a sale transaction there are two entries, one for sale account, and other for the customer. 

id    | trid | date           | Account            | Amount

---

112 | 33 |01-04-2013 | Sales A\c          | 300.00  

113 | 33 |01-04-2013 | Customer A\c   | 300.00  

114 | 34 |01-04-2013 | Sales A\c          |110.00  

115 | 34 |01-04-2013 | Customer 1 A\c | 110.00  

116 | 35 |01-04-2013 | Sales A\c           | 250.00  

117 | 35 |01-04-2013 | Customer 2 A\c | 250.00  

here, TRID is MAX(TRID) + 1. This concept works fine on single user environment, but in a multiple user environment where application is used concurrently by more than one user, one or more user's can get same TRID. 

what could be the solution for that ?