T
TexasStar
I have a simple form with 2 buttons and text box. When the user clicks
the "Select File" button this allows them to browse their hard drive
and select a csv file. The patch to the csv file is in the text box.
The second button is "Import File" which the user would click and
import the data into a table called PDS_Import.
I am getting errors when the users tries to Import the data into the
table.
This is the code that allows the user to select a file from their hard
drive. This seems to work and returns the path into a textbox named
"File2"
_________
Private Sub SelectFile_Click()
'Use file open dialog to select file
On Error GoTo ErrorHandler
Me.File2 = OpenFile(Me.File2)
GoTo Done
ErrorHandler:
MsgBox "Error: " & Err.Description & " (" & Err.Number & ")"
Done:
Exit Sub
End Sub
___________
This ImportFile function is what seems to be the problem.
_______________________
Private Sub FileImport_Click()
Dim stringPathFile As String, strFile As String, strPath As String,
strSpec As String
Dim strTable As String, ynFieldName As Boolean
strPathFile = Me.File2
strTable = "PDS_Import"
ynFieldName = True
DoCmd.TransferText acImportDelim, strTable, strPathFile, ynFieldName
End Sub
___________________________
If anyone could help me out it would be greatly appreciated. I think
it might be something simple but I just can't catch what the problem
is and why I can't get the import function to work. Thank you for any
advice or help you can provide.
the "Select File" button this allows them to browse their hard drive
and select a csv file. The patch to the csv file is in the text box.
The second button is "Import File" which the user would click and
import the data into a table called PDS_Import.
I am getting errors when the users tries to Import the data into the
table.
This is the code that allows the user to select a file from their hard
drive. This seems to work and returns the path into a textbox named
"File2"
_________
Private Sub SelectFile_Click()
'Use file open dialog to select file
On Error GoTo ErrorHandler
Me.File2 = OpenFile(Me.File2)
GoTo Done
ErrorHandler:
MsgBox "Error: " & Err.Description & " (" & Err.Number & ")"
Done:
Exit Sub
End Sub
___________
This ImportFile function is what seems to be the problem.
_______________________
Private Sub FileImport_Click()
Dim stringPathFile As String, strFile As String, strPath As String,
strSpec As String
Dim strTable As String, ynFieldName As Boolean
strPathFile = Me.File2
strTable = "PDS_Import"
ynFieldName = True
DoCmd.TransferText acImportDelim, strTable, strPathFile, ynFieldName
End Sub
___________________________
If anyone could help me out it would be greatly appreciated. I think
it might be something simple but I just can't catch what the problem
is and why I can't get the import function to work. Thank you for any
advice or help you can provide.