You can call COM1 in COM2 by instantiating COM1 in COM2.
Here's a sample code:
COM2 Code:
Dim m_objCOM1 As COM1
Private Sub Class_Initialize()
Set m_objCOM1 = New COM1
'you can now call any public function/sub in COM1
'example:
'm_objCOM1.procProcessTransactions
End Sub
If COM2 fails, you can rollback transactions from COM1 by doing this:
1. Have a On Error routine in COM2
2. In COM1 have a procedure that will rollback transactions
(i don't know if your using ADO)
3. Call that routine in COM2, if COM2 fails.
Code in COM1:
Public Sub procRollbackTrans
'put your code here
End Sub
Code in COM2:
Dim m_objCOM1 As COM1
Private Sub Class_Initialize()
On Error GoTo ErrHandler
Set m_objCOM1 = New COM1
'put your code here
Exit Sub
ErrHandler:
m_objCOM1.procRollbackTrans
End Sub