If you add the MsgBox line as shown below:-
form = ThisDatabaseDocument.FormDocuments.getByName("myForm")
MsgBox form.dbg_properties
textArea = form.getByName("Console")
you will see that the MsgBox shows
Properties of object
“com.sun.star.comp.dba.ODocumentDefinition”:
so the form object created is not the form but the Form Document Definition.
Change the code to
form = ThisComponent.Drawpage.Forms.getByName("myForm")
MsgBox form.dbg_properties
textArea = form.getByName("Console")
and the MsgBox will show
Properties of object
“com.sun.star.comp.forms.ODatabaseForm”:
so the form object is now your Form.
You get the error on your second line as there is no getByName() method for the DocumentDefinition object.
EDITED 29/01/2015
How are you running the Macro? If you run it from a form event such as a button click or from the Toolbar on the Form Tools>Macros>Run Macro it will work. If you run it from the toolbar on the main LO window or from the Macros Window it will fail. ThisComponent or ThisDatabaseDocument points to the Document that has the focus so the Form must have the focus.
There is a quick way of getting the Form Object using the Macro below.
Sub Button(e)
oForm = e.Source.Model.Parent
End Sub
The Macro is run from a Button Click event on a Button on the Form. The Argument (e) is required in the Macro. When run the Argument e is passed to the Macro. The Source of the event e is the Button Object and the Parent of the Button is the Form Object.