Afternoon all.
I have a large .txt file which is Fixed width. I had created an Import spec and works fine.
I have 7 files for each day of the week sent to me on a Monday.
The problem I have is I need to import these files one by one and have someway of entering the date of the file for each of those records.
I have created a VB script which does exactly the same thing as the import wizard but I need to adapt it so it will prompt to enter the date of the file and add that to each of the records that have been imported.
Code:
Dim ImportFileName As String
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.txt")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
ImportFileName = strInputFileName
DoCmd.TransferText acImportFixed, "OR96 Import specification", "cancellations", strInputFileName
Something like this.
1. Asks user for date of file
2. Import the records from that file in table 'cancellations'
3. Add the value from step 1 to the field 'Cancel Date' for only those records imported
Hope I have explained myself in a way you guys can understand