A family of Microsoft relational database management systems designed for ease of use.
Create an Import Specification, and then set that argument in DoCmd.TransferText.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have the following code in Access that will import files into a table and everything works fine but I'd like to build on it and only bring in specific columns. Right now all the columns are coming in, these are external files so sometimes some of the fields are missing or others are added which kills the process (doesn't happen all the time but annoying when it does). What and where can I add a code to import i.e. BatchId, MemberId?
Function COMWEL15()
Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
' Change this next line to True if the first row in EXCEL worksheet has field names
blnHasFieldNames = True
' Path to the folder that contains the files
strPath = "F:\HOME\COMMON\2018\COMWEL15_"
' Table into which the data are to be imported
strTable = "COMWEL15_MASTER_RESULTS"
'Path and FileName
strFile = Dir(strPath & "*.csv")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferText acImportDelim, , _
strTable, strPathFile, blnHasFieldNames
strFile = Dir()
Loop
Call MDWEL
End Function
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Create an Import Specification, and then set that argument in DoCmd.TransferText.