Hello,
Im having a problem with RunTime error 2495 – The action or method requires a table name argument.
My code is supposed to run in a form, call a public function in a module to select a save location, then return to the form code to export a file.
I have the public code as a lot of forms will be using it (if I can get past this hurdle).
I've pasted my code in below.
Thanks for any help.
Im having a problem with RunTime error 2495 – The action or method requires a table name argument.
My code is supposed to run in a form, call a public function in a module to select a save location, then return to the form code to export a file.
I have the public code as a lot of forms will be using it (if I can get past this hurdle).
I've pasted my code in below.
Thanks for any help.
Call ExpFile
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, MyQry, DestFile 'Debug highlights this row
End If
Option Compare Database
Public FileName As String
Public FilePath As String
Public DestFile As Variant
Public Sub ExpFile()
Dim FSelect As Office.FileDialog
Dim Mth As String
Dim Dte As String
Dim Tme As String
Dim NewFile As String
Mth = Format(Now, "YYYYMM")
Dte = Format(Now, "YYYYMMDD")
Tme = Format(Now, "HH-MM-SS")
MyFile = ""
NewFile = ""
'Select Save Loction
Set FSelect = Application.FileDialog(msoFileDialogSaveAs)
With FSelect
.AllowMultiSelect = False
.InitialFileName = FileName
.Title = "ATMT: Please select a location"
If .Show = True Then
For Each DestFile In .SelectedItems
DestFile = .SelectedItems(1)
Next
End If
End With
End Sub