Hi Bjorn,
Are you using a Custom Form from a SharePoint list? If so then I believe that the option to use code will not be available. If you wish to write code, then you would need to re-create the form using a blank form in InfoPath Designer (go to Start > All Programs > Microsoft Office > InfoPath Designer). Hope this helps.
Regards,