Note that there are some explanatory texts on larger screens.

plurals
  1. POuser defined Parameter used as part of a filename in Access
    primarykey
    data
    text
    <p>I have an access 2007 Database that outputs a report in excel format, the report is dependent on a date parameter that is chosen by the user. This parameter is selected via a textbox (text100) that has a pop up calendar. I would like to use the date in the text box(text100) as part of the filename. I am using the transferspreadsheet method to create the export, However I do not need the column headers. Once the file is created I have the code open the file and delete the headers. Also the current code is using todays date in the filename which is not accurate. The filename needs to reflect the date that was selected by the user in the text box from the pop up calendar</p> <p>Ok here is the code.</p> <pre><code>Sub Branch298nohdr() Dim Filename As String Dim Path As String Dim Branch As Integer Dim Text100 As Date Dim xl Branch = "298" Path = "Path" &amp; Branch &amp; "\" Filename = "Identity Report " &amp; Branch &amp; " " &amp; _ Replace(Text100, ":", " ") &amp; ".xls" If Dir(Path &amp; Filename) &lt;&gt; "" Then MsgBox "File has been created already" If Dir(Path &amp; Filename) &lt;&gt; "" Then GoTo 53 End If Else Set xl = CreateObject("excel.application") TempVars.Add "branchnum", Branch DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, _ "queryname", Path &amp; Filename, False xl.workbooks.Open Path &amp; Filename With xl .Rows("1:1").entirerow.Delete .Columns("L:L").select .Selection.NumberFormat = "0" .range("a1").select xl.workbooks(1).Close Savechanges:=True xl.Quit Set xl = Nothing 53 MsgBox "Done!" End With TempVars.Remove "branchnum" End If Branch298nohdr_Exit: Exit Sub End Sub </code></pre> <p>Text 100 is where the user selects a date via a pop up calendar. I would like to use this date as part of the file name. Currently using the text100 as part of the filename it is being referenced as 12:00 am, and then adds this to the file name. I hope this clears up my intention.</p> <p>Text 100 gets set on the opening form then there are several buttons which allow the user to pick between several branches or all branches. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload