我正在尝试附加一个Excel文件,该文件的路径来自当前表单上名为txtFileName
的控件;我正在尝试将其附加到表Load Report 1
中。
SQL语句导致语法错误:
不完整的条款
我的代码如下:
Private Sub Import_Click()
Dim FSO As New FileSystemObject, fileName As String, tableName As String, item As Variant, diag As Office.FileDialog
Set diag = Application.FileDialog(msoFileDialogFilePicker)
For Each item In diag.SelectedItems
Me.txtFileName = item
Next
If FSO.FileExists(Me.txtFileName) Then
DoCmd.RunSQL ("INSERT INTO [Load Report1].*,Select Me.txtFileName.*,From Me.txtFileName.*")
Else
MsgBox "File Not Found!"
End If
End Sub