P
pjd33
I have a report that is produced from a combo box on a Form.
I want to be able to setup a command button on the Form to save the results
as an Excel file and use the option from the dropdown menu and the current
date into the filename. At present I can export and enter the date but I
cannot work out how to put the drop down option into the filename.
The combo box is named cboLateListAssetClass
There are 4 options (A, B, C , D) to choose from before the report is run
and if B were selected I would like the filename to read "yyyymmdd B
LateList.xls"
Current code for the command button is:
Private Sub cmdSaveLateList_Click()
DoCmd.OpenQuery "qryLateList", acViewNormal, acEdit
DoCmd.Close acQuery, "qryLateList"
Dim sToday As String
sToday = Format(Date, "yyyymmdd")
DoCmd.OutputTo acReport, "rptLateList", acFormatXLS, "U:\Database\" &
sToday & " LateList.xls", True
End Sub
Many thanks for any help
I want to be able to setup a command button on the Form to save the results
as an Excel file and use the option from the dropdown menu and the current
date into the filename. At present I can export and enter the date but I
cannot work out how to put the drop down option into the filename.
The combo box is named cboLateListAssetClass
There are 4 options (A, B, C , D) to choose from before the report is run
and if B were selected I would like the filename to read "yyyymmdd B
LateList.xls"
Current code for the command button is:
Private Sub cmdSaveLateList_Click()
DoCmd.OpenQuery "qryLateList", acViewNormal, acEdit
DoCmd.Close acQuery, "qryLateList"
Dim sToday As String
sToday = Format(Date, "yyyymmdd")
DoCmd.OutputTo acReport, "rptLateList", acFormatXLS, "U:\Database\" &
sToday & " LateList.xls", True
End Sub
Many thanks for any help