PhenomHTPC
New member
- Local time
- Yesterday, 20:45
- Joined
- Dec 13, 2011
- Messages
- 6
Hi Boblarson,
I kept this new thread in the Macros section if thats ok. Looking forward to seeing what you suggest. I am also using Access 2010, so I hope there are no problems. Here is my original question:
I am currently working in a data base that I have created, which uses the same function of the open/save dialog box to import files into a database, and it is based off of the code from the link you have placed in the previous posts. I am able to import one file at a time perfectly, but I am wondering how to import multple files at once, which will all append into the same table. In the code there is a line to select multiple files, but the docmd.transfertext no longer works. Is there a way to have the multiple files imported besides re-running this code for every file I would neet?
Here is the code I am currently using as well.
Thanks for the quick response,
~John
I kept this new thread in the Macros section if thats ok. Looking forward to seeing what you suggest. I am also using Access 2010, so I hope there are no problems. Here is my original question:
I am currently working in a data base that I have created, which uses the same function of the open/save dialog box to import files into a database, and it is based off of the code from the link you have placed in the previous posts. I am able to import one file at a time perfectly, but I am wondering how to import multple files at once, which will all append into the same table. In the code there is a line to select multiple files, but the docmd.transfertext no longer works. Is there a way to have the multiple files imported besides re-running this code for every file I would neet?
Here is the code I am currently using as well.
Thanks for the quick response,
~John
Code:
Dim strFilter As String
Dim lngFlags As Long
'strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
"*.MDA;*.MDB")
'strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
'strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
' Uncomment this line to try the example
' allowing multiple file names:
lngFlags = ahtOFN_ALLOWMULTISELECT Or ahtOFN_EXPLORER
Dim result As Variant
result = ahtCommonFileOpenSave(InitialDir:="I:\CI00710\Commissions\Smart Office\Golden Rule", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")
If lngFlags And ahtOFN_ALLOWMULTISELECT Then
If IsArray(result) Then
Dim i As Integer
For i = 0 To UBound(result)
MsgBox result(i)
Next i
Else
MsgBox result
End If
Else
MsgBox result
End If
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
Debug.Print Hex(lngFlags)
DoCmd.TransferText acImportDelim, "", "tblgoldenruledata", result, True, ""