It is a good question. When one really understands the difference one can see that eventual result of one getting attached AND committing kamma happens in two steps.
As we discussed many times, we get “attached” to something AUTOMATICALLY based on our gati. These first arise as mano sankhara. This will happen as long as we have tanhā (either via either via kama raga or patigha; avijja is present in both cases). We automatically get attracted; see, “Tanhā – How We Attach Via Greed, Hate, and Ignorance“.
Now, as soon as we becomes aware of this “attachment” to something, we have the ability to be mindful and think about its consequences and move away from it. We can do this at the early vaci sankhara stage; see, “Correct Meaning of Vacī Sankhāra“.
On the other hand, if we just “go with the flow” and go along enjoying this sense attraction, that is what is called “upādāna“. It basically means “pulling it closer” (“upa” + “ādāna”, where “upa” means “close” and “ādāna” means “pull”).
So, basically do not have control over the “tanhā” or “initial attachment” step. It happens with mano sankhara that arise due to our gati.
But if we are mindful, we can immediately become aware of it at the vaci sanhara stage (where we are just thinking to ourselves about this sense input, even before speaking out loud about it), we CAN stop the upādāna step, i.e., we can decide not to “pull it closer”.
For example, if we see an attractive person, we may automatically start looking at him/her. But once we become aware of it, we can look away, and start thinking about something else.
In another extreme example, a person who is trying to control anger, may start talking back to someone who just said something harsh. But as soon as realizing that one is going back to the old habit, one can even stop in the mid-sentence.
When we start controlling the upādāna step, our gati will slowly change. Then, with time, the first step of “tanhā” will reduce, and eventually go away.
That is the basis of Anapana and Satipatthana meditations.
We also remember that in Paticca Samuppada, it is “..vedana paccaya tanha, tanha paccaya upadana..”. So, tanha comes first, and then upadana.