Hi all
I will like to change the Database and File name to be variable on the below code
Thanks in advance.
I will like to change the Database and File name to be variable on the below code
Thanks in advance.
Rich (BB code):
Sub ImportCSVFile()
DeleteTable
'Browse for Folder
Dim selectedFolder
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
selectedFolder = .SelectedItems(1)
End With
'print to screen the address of folder selected
'MsgBox (selectedFolder)
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT * INTO CurrentData FROM [Text;DATABASE= & selectedFolder ;HDR=Yes].DennisReport.csv"
'DoCmd.RunSQL "SELECT * INTO CurrentData FROM [Text;DATABASE=C:\Users\Hashiru\Desktop\Report Templates;HDR=Yes].DennisReport.csv"
DoCmd.SetWarnings True
End Sub
Last edited: