I'm new into VBA coding, I am looking into creating an Import UI in ms access for user to import CSV files and insert into a new temp table, from the temp table there will be SQL query to split data into different tables and lastly drop the temp table.
As per the codes, I have created the import button and coded the file picker. However I am lost on how to code it to import into a new temp table and follow by the SQL queries.
Appreciate all helps
Sub ImportButton_Click()
Dim strfilename As String
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select the CSV file to import"
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "CSV Files", "*.csv", 1
.Filters.Add "All Files", "*.*", 2
If .Show = -1 Then
strfilename = .SelectedItems(1)
DoCmd.TransferText TransferType:=acImportDelim, _
TableName:="Import_Table", FileName:=strfilename
Else
Exit Sub
End If
End With
End Sub