Below is the code I am using to export to a network drive. Can someone help with what I am doing wrong?
Option Compare Database
Private Sub Command2_Click()
Dim MyFolder As String
Dim MyFile As String
Dim MyFolder2 As String
Dim FilePath As String
Dim FileContent As String
Dim TextFile As Integer
Dim MyFile2 As String
Dim fso As Object
Dim sFile As String
Set fso = CreateObject("Scripting.FileSystemObject")
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Show
.InitialFileName = .SelectedItems.Item(1)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
MyFolder2 = .InitialFileName
MyFile = Dir(MyFolder2)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
DoCmd.TransferText acImportDelim, "Import Specification", "NewBadRecips", MyFile, True
sFile = "NewBadRecipsQuery.xlsx"
DoCmd.OutputTo acOutputQuery, "NewBadRecipsQuery", "Excel Workbook (*.xlsx)", "\\NAEAST.AD.JPMORGANCHASE.COM\AMERTSS$\TSSTSERV\FLSHARE05\DATA18\LIST MAINTENANCE\FRAUD- RETAIL\CLR Templates" & sFile, True
Name sFile As MyFile
DoCmd.SetWarnings False
MsgBox "Process Complete"
End With
End Sub
Option Compare Database
Private Sub Command2_Click()
Dim MyFolder As String
Dim MyFile As String
Dim MyFolder2 As String
Dim FilePath As String
Dim FileContent As String
Dim TextFile As Integer
Dim MyFile2 As String
Dim fso As Object
Dim sFile As String
Set fso = CreateObject("Scripting.FileSystemObject")
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Show
.InitialFileName = .SelectedItems.Item(1)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
MyFolder2 = .InitialFileName
MyFile = Dir(MyFolder2)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
DoCmd.TransferText acImportDelim, "Import Specification", "NewBadRecips", MyFile, True
sFile = "NewBadRecipsQuery.xlsx"
DoCmd.OutputTo acOutputQuery, "NewBadRecipsQuery", "Excel Workbook (*.xlsx)", "\\NAEAST.AD.JPMORGANCHASE.COM\AMERTSS$\TSSTSERV\FLSHARE05\DATA18\LIST MAINTENANCE\FRAUD- RETAIL\CLR Templates" & sFile, True
Name sFile As MyFile
DoCmd.SetWarnings False
MsgBox "Process Complete"
End With
End Sub