Te da una violacion de memoria porque estas comparando un tobject con un tbutton sin ningun parseo de clase. Es decir, aparte que hay maneras alternativas mucho mejores. Yo por ejemplo utilizaria el nombre del boton, la propiedad tag o la propiedad hint para identificar el boton origen.
Código:
If (Sender as Tcontrol).name = 'button1' then
....
Tomando tag=1 para form1 y tag=2 para form2
Código:
If (Sender as Tcontrol).tag = '1' then
....
O mejor aun, pensando que puedes llamarlo desde distintos botones utilizar la propiedad parent
Código:
If (Sender as TWincontrol).Parent.name = 'form1' then
....
If (Sender as TWincontrol).Parent.name = 'form2' then
....