Hi,
I'm trying to find/write a code that will allow me to import separate csv files into separate tables.
The table it will be imported to is determined like this:
If cboCompany = CompanyA and cboInvType = TypeA then
import to tbl_CompanyA_TypeA
append txtinvoiceenddate to Invperiod
If cboCompany = CompanyA and cboInvType = TypeB then
import to tbl_CompanyA_TypeB
append txtinvoiceenddate to Invperiod
If cboCompany = CompanyB and cboInvType = TypeA then
import to tbl_CompanyB_TypeA
append txtinvoiceenddate to Invperiod
What I mean by "append txtinvoiceenddate to Invperiod" that in each table there is a field called Invperiod (Invoice period)
The user has to enter the invoice end date in a form.
That date has to be added & repeat for all records in the newly imported file. It should not overwrite any existing records in the table.
My idea is to just have lots of if statements and DoCmd.TransferSpreadsheet statements for the separate scenerios
Is this efficient?
And how do I add the invoice period to only the new data I am importing?
Are there any sample databases out there, that import separate files into separate existing tables?
I should add that I've already got the browse button and txtPath to work.