The only problem with the code you show is that you leak the form. You create it with no owner, and nothing else destroys it.
The obvious way to deal with that is to own it:
Form2 := TForm2.Create(Self);
This may not fix your error but it is the only thing wrong with the code you showed.