Hello and good day:
I have been working on this for several days, and just can't figure out, let me explain.
I have been working on this for several days, and just can't figure out, let me explain.
- I have a query called "Open Orders By Supplier", that is controled by a combo box.
- Depending on the value in the comobo box, when I run my query, I get the open orders for the "specific" supplier.
- For example purposes I have 2 suppliers.
- ACME
- Oscorp
- For example purposes I have 2 suppliers.
- I then Click a button and export this query to Excell, and generate a name to file based on the date and time of the export, I am using the code bellow:
- Private Sub Command99_Click()
- Dim FilePath As String
- Dim FileName As String
- FilePath = Environ("userprofile") & "\Documents\18_Open_Orders\Open_Order_Sup_analysis"
- FileName = FilePath & "_" & Format(Now, "mm.dd.yyyy_hh.mm") & ".XLSX"
- DoCmd.OutputTo acOutputQuery, "qry_Open_Orders_By_Sup_anaysis", acFormatXLSX, FileName, , , , acExportQualityPrint
- MsgBox "Exported Successfully", vbInformation, "To Excel"
- The result i get is a file named:
- Open_Order_Sup_analysis_12.12.2022_19.02
- Which is EXCELENT!!!
- However it would ideal if the name were:
- Open_Order_Sup_analysis_ACME_12.12.2022_19.02 or Open_Order_Sup_analysis_OSCORP_12.12.2022_19.02
- Depending on what supplier is the one on the query.
- Open_Order_Sup_analysis_12.12.2022_19.02