Tan,
Create a spearate table for creating compound IDs. This table would be;
Compound ID ID
A1 A1
A1 C1
A1 C3
B1 A1
...
The ID points to a record in the existing IDs table. In the new table you can make the combination of the Compound ID and the ID into a Candidate index thus preventing and duplicates.