H
Henrootje
Hello Access-guru's, wizards and helpful people!
I am trying to import several textfiles into several tables.
Now I thought the following code up which works swell:
But I copy this code for every file and table I have to import.
Is it somehow possible to create for example a table containing the
tablenames, Importspecifications and so on?
Importspecification TableName File2BImported
Transactions tblTransactions
c:\temp\transactions.txt
Materials tblUsedMaterial
c:\temp\materials.txt
.............. ..............
....................
So that it will take the first record out of the table, fill the
variables using the first record in the table, execute the code and
then proceed with the second record, execute the code and so on and on
untill the end of the table? (seciond run would be as below
I do not mind if it would be a matrix in code, not using a table. These
values will not change often, seldom even, but I want to reuse code
where I can, to prevent typingerrors and stuff.
I think it should be not that hard but to me unfortunately it is
TIA, Henro!
I am trying to import several textfiles into several tables.
Now I thought the following code up which works swell:
Code:
Dim Importspecification, TableName, File2BImported as string
Importspecification ="<my Importspecification>"
TableName = "<my Tablename>"
File2BImported= "<my File to be imported>"
DoCmd.TransferText acImportDelim, Importspecification, TableName,
File2BImported, False, ""
But I copy this code for every file and table I have to import.
Is it somehow possible to create for example a table containing the
tablenames, Importspecifications and so on?
Importspecification TableName File2BImported
Transactions tblTransactions
c:\temp\transactions.txt
Materials tblUsedMaterial
c:\temp\materials.txt
.............. ..............
....................
Code:
Dim Importspecification, TableName, File2BImported as string
Importspecification ="Transactions"
TableName = "tblTransactions"
File2BImported= "c:\temp\transactions.txt"
DoCmd.TransferText acImportDelim, Importspecification, TableName,
File2BImported, False, ""
So that it will take the first record out of the table, fill the
variables using the first record in the table, execute the code and
then proceed with the second record, execute the code and so on and on
untill the end of the table? (seciond run would be as below
Code:
Importspecification ="Materials"
TableName = "tblUsedMaterial"
File2BImported= "c:\temp\materials.txt"
DoCmd.TransferText acImportDelim, Importspecification, TableName,
File2BImported, False, ""
I do not mind if it would be a matrix in code, not using a table. These
values will not change often, seldom even, but I want to reuse code
where I can, to prevent typingerrors and stuff.
I think it should be not that hard but to me unfortunately it is
TIA, Henro!