I just did it in VBA my own way and it works fine. I was just hoping if access did it a better way or maybe cleaner code. Here is my solution for those wondering how to do the same:
Code:
dim rs as recordset
dim idHolder as integer
dim strSQL as String
dim strSQL2 as String
Set rs = CurrentDb.OpenRecordset("table1", dbOpenSnapshot)
rs.FindFirst "Company='" & Me.txtCompanyName & "'"
if rs.NoMatch Then
strSQL2 = "INSERT INTO table1(CompanyName) VALUES('" & txtCompanyName & "');"
DoCmd.RunSQL strSQL2
Me.Requery
idHolder = DMax("ID", "table1")
Else
idHolder = rs!ID
End If
strSQL = "INSERT INTO table2(CompanyID,Customer) VALUES ('" & idHolder & "', '" & txtCustomerName & "');"
DoCmd.RunSQL strSQL
Me.Requery