As pbaldy explained, you need to create a public subprocedure or function and refer to this function in the Form_Open event of an Access form. Creating subprocedures and functions is considered a separate skill itself, so you need to read books on this topic to further improve your programming skills.
Code:
Public Sub RecordForm (ByVal FormName as String)
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblForms (FormName) VALUES (" & ''" & FormName & "')"
DoCmd.SetWarnings True
End Sub
Private Sub Form_Open()
Call RecordForm("frmPrices")
End Sub