Hi:
When you build your form off a database, you have the opportunity to select the tables that the form will use for the main data source. You can also set up the relationships between the parent and child tables. When you submit, if you have an ID field in you master table that is auto incremented in SQL, your related child table fields should also have that value populated auto-magically.
The last screen of the data wizard will have a check box for allowing submit. If that control is disabled, it means there is (most likely) a data type in your tables that InfoPath doesn't handle, or a relationship it doesn't handle. Please read all the text in the last dialog for information as to why your form may not be able to submit.
Also, since you are new to InfoPath, I highly recommend these MSDN labs. While written for IP 2003, much of the basic information is still valid for 2007.
Hope that helps!