G
Guest
I had the following code in which 3 option buttons on a form that can be
selected and the output is done per select. I added another option for html
output along with code but the results are both excel and html sent to my
desktop instead of the single selection of html. Can someone see what am i
missing please.
Select Case fraOutput
Case 1 ' Run Query
DoCmd.OpenQuery "qryCustomers"
Case 2 ' Preview Report
DoCmd.OpenReport "rptOrder", acViewPreview
Case 3 ' html
DoCmd.OutputTo acQuery, "testonhtm", "HTML(*.html)",
"C:\Users\Desktop\testonhtm.htm", False, "", 0
Case 4 ' Export to Excel
DoCmd.OutputTo acOutputQuery, "qryCustomers", acFormatXLS, _
strPath & "\" & strFile ', 0
DoCmd.TransferSpreadsheet _
TransferType:=acExport, TableName:="qryUnion1", _
FileName:=strPath & "\" & strFile,
HasFieldNames:=True
MsgBox "Files has succesfully exported the file: " _
& vbCrLf & " '" & strFile & "'" & vbCrLf &
vbCrLf & "in the folder:" _
& vbCrLf & " '" & strPath & "'",
vbInformation, "Export Complete..."
Case Else
End Select
selected and the output is done per select. I added another option for html
output along with code but the results are both excel and html sent to my
desktop instead of the single selection of html. Can someone see what am i
missing please.
Select Case fraOutput
Case 1 ' Run Query
DoCmd.OpenQuery "qryCustomers"
Case 2 ' Preview Report
DoCmd.OpenReport "rptOrder", acViewPreview
Case 3 ' html
DoCmd.OutputTo acQuery, "testonhtm", "HTML(*.html)",
"C:\Users\Desktop\testonhtm.htm", False, "", 0
Case 4 ' Export to Excel
DoCmd.OutputTo acOutputQuery, "qryCustomers", acFormatXLS, _
strPath & "\" & strFile ', 0
DoCmd.TransferSpreadsheet _
TransferType:=acExport, TableName:="qryUnion1", _
FileName:=strPath & "\" & strFile,
HasFieldNames:=True
MsgBox "Files has succesfully exported the file: " _
& vbCrLf & " '" & strFile & "'" & vbCrLf &
vbCrLf & "in the folder:" _
& vbCrLf & " '" & strPath & "'",
vbInformation, "Export Complete..."
Case Else
End Select