I tried the code here: http://www.mvps.org/access/api/api0001.htm
to open
file dialog so the user can im****t the txt files they select.
The code I have follows (I used the code from his TestIt function and
added
to that:
Private Sub Command0_Click()
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 (*.*)", "*.*")
MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
Debug.Print Hex(lngFlags)
DoCmd.TransferText acIm****tFixed, FileIm****tSpec, tblIm****t, strFilter
Everything stops on the transfer text part and says error 31519 can't
im****t
that type of file. I can right click in the database window and im****t
the
files from there using the specs named above. It does not im****t
correctly
if I try a macro either. I don't get the same error it just does not
im****t
all the data, it dumps it off into an error table. Is there another
setting
in the file specs setup that I may have missed? I have been fiddling with
this for 2 hours now. Kinda stuck...
Thanks,
John


|