Hi,
Try:
Else
strFileNamePart = InputBox(“File ” & strFileName & ” already exists,” _
& Chr(10) & “Please enter another filename not including ” _
& Chr(34) & “.xls” & Chr(34) & “: “)
if strFileNamePart = “” then exit sub
strFileName = “S:SRI_WORK_AREADOCUME~1” _
& strFileNamePart & “.xls”
DoCmd.OutputTo acOutputQuery, “SFMTradeReport”, acFormatXLS, strFileName, True
MsgBox “Data has been exported successfully.”, vbInformation, “Export Confirmation”
End If
You will need to add Dim strFilenamePart as String to the start of your code.
Hope that helps.