one to one relation in a function

one to one relation in a function

I have got a new issue to work out.
Form Profile is linked to Form Person through lookup field Lookup_Profile.

I want to allow only one entry of Profile for each record in Person.

And create a function (with a button in Person records) that opens a new Profile record OR the existing one if it already exists.

I didn't get much further than fetching all records of Profile in a variable. Like
recProfile = Profile ( ID != 0 );

After that I would need to check if the Lookup_Profile already is in recProfile.
And then if yes open the record for updating.
If no, then open a blank record for creating.

Is this the right way of thinking or totally wrong approach? Some hints script-wise welcome. Or if that's too vague I can make a draft tomorrow for commenting on.