Mr Scott McDaniel
Thank you for your clever explanation.
Although I have understood the main idea of your bright code, I have some questions about:
- " To import to a staging table, you can use the External Data - Import & Link - Text File ribbon item. Let's assume you import to a table named "tImport"
So importing by External Data - Import & Link - Text File works even if the C100 line have a number of columns diferent from the C170 line' s number of columns??
2. If rst(0) = "C100" Then
' you're at an Invoice header; create a new record in the Insert recordset:
Currentdb.Execute "INSERT INTO tC100(Col1, Col2, Col3, etc) VALUES(" & rst(1) & "," & rst(2) & "," & rst(3) & ",etc etc) '<<<< code row Y
Dim rstInvoice As DAO.Recordset
Set rstInvoice = Currentdb.OpenRecordset("SELECT @@IDENTITY") '<<<<< code row X
I never heard about the statemant 'Select @@Identity' until now. I presume that the entire code row X creates a record that is identical to the last record created by code row Y. Is that correct? Does this statemant 'Select @@Identity' work at ms access 2007 plataform?
Well, you give a lot of code to work with. The result I will tell you soon.
Best regards.