I have the following code as part of a module, which I run using a 'RunCode' within a macro.
With Application.FileSearch
.NewSearch
.LookIn = "K:\WL CMDS (Current Financial Year)_\Dudley Group of Hospitals NHS Trust\Inpatient Waiting _List CMDS"
'Below File needs to be updated each month with the _latest filename
.FileName = "08 IWL Nov (QEE).txt"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
DoCmd.TransferText acImportFixed, "IPWL 04 _RNA Import", "WL CMDS (RNA00)", .FoundFiles(i)
Next i
End If
End With
The FileName can be any of the following:
01 IWL Apr (QEE).txt
02 IWL May (QEE).txt
03 IWL Jun (QEE).txt
04 IWL Jul (QEE).txt
05 IWL Aug (QEE).txt
06 IWL Sep (QEE).txt
07 IWL Oct (QEE).txt
08 IWL Nov (QEE).txt
09 IWL Dec (QEE).txt
10 IWL Jan (QEE).txt
11 IWL Feb (QEE).txt
12 IWL Mar (QEE).txt
How can I run the module, using the macro but get the option to select which file from the above should be imported?
With Application.FileSearch
.NewSearch
.LookIn = "K:\WL CMDS (Current Financial Year)_\Dudley Group of Hospitals NHS Trust\Inpatient Waiting _List CMDS"
'Below File needs to be updated each month with the _latest filename
.FileName = "08 IWL Nov (QEE).txt"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
DoCmd.TransferText acImportFixed, "IPWL 04 _RNA Import", "WL CMDS (RNA00)", .FoundFiles(i)
Next i
End If
End With
The FileName can be any of the following:
01 IWL Apr (QEE).txt
02 IWL May (QEE).txt
03 IWL Jun (QEE).txt
04 IWL Jul (QEE).txt
05 IWL Aug (QEE).txt
06 IWL Sep (QEE).txt
07 IWL Oct (QEE).txt
08 IWL Nov (QEE).txt
09 IWL Dec (QEE).txt
10 IWL Jan (QEE).txt
11 IWL Feb (QEE).txt
12 IWL Mar (QEE).txt
How can I run the module, using the macro but get the option to select which file from the above should be imported?