MentallyDestructive
New member
- Local time
- Today, 16:22
- Joined
- Nov 8, 2011
- Messages
- 3
Hello. I have a database which allows a user to import multiple .csv files at one time and adds them to a table. The file name format is based on the date and time including seconds which eliminates the possibility of duplicates since one person creates these throughout the day. Each file is considered a "batch" and can contain anywhere from 1 to 50 (or more) line items. If I can capture the file name and import that into the table that will allow me to show how many "batches" have been submitted.
Is there code that is compatible with what I am currently doing that will also import the filename into the table?
Operating System: Windows XP Professional
Program: Microsoft Access 2003
Example of .csv File Name: AROPS20111104145057.csv (AROPSYYYYMMDDHHMMSS.csv)
Here is the code I am currently using and it works wonderfully:
Function ImportARData()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = True
.Title = "Choose Files to Import"
.Filters.Clear
.Filters.Add "Text Files", "*.csv"
If .Show = True Then
For Each varFile In .SelectedItems
DoCmd.TransferText acImportDelim, "AROPSImport", "tbl_AROPSImport", varFile
Next
Else
MsgBox "You have cancelled the import."
End If
End With
End Function
Any help you can provide would be greatly appreciated. Thank you.
Is there code that is compatible with what I am currently doing that will also import the filename into the table?
Operating System: Windows XP Professional
Program: Microsoft Access 2003
Example of .csv File Name: AROPS20111104145057.csv (AROPSYYYYMMDDHHMMSS.csv)
Here is the code I am currently using and it works wonderfully:
Function ImportARData()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = True
.Title = "Choose Files to Import"
.Filters.Clear
.Filters.Add "Text Files", "*.csv"
If .Show = True Then
For Each varFile In .SelectedItems
DoCmd.TransferText acImportDelim, "AROPSImport", "tbl_AROPSImport", varFile
Next
Else
MsgBox "You have cancelled the import."
End If
End With
End Function
Any help you can provide would be greatly appreciated. Thank you.