Case select on output

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
 
G

Guest

Locate the cursor in this line:

Select Case fraOutput

Press F9 key to add a code break (red line will apear), run the form and
press the button to print the HTML.
The code will stop at the line above, press F8 to step the code, check where
it goes to.

To remove the code break press F9 again on the same line.

You can also check the value of "fraOutput" if it has the right value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top