title: VBA date format
body: <p>I have created a VBA function that selects some data from an Access table and puts that data into a temp table. I want to change the format of a date column using the following code so that the date has the leading '0'.</p>
  
  <pre><code>Dim lValue As String
  lValue = Format(Transaction_Date, "mm/dd/yyyy")
  Dim i As Integer
  SQL = "SELECT ID, PO_Number, Vendor_Company, Incurred_By, Transaction_Type, lValue as Transaction_Date, Investment_ID, " &amp; _
  "Notes, Quantity INTO tmp_Tran_Actual FROM Transaction_Data"
  DoCmd.RunSQL SQL
  </code></pre>
  
  <p>When the code runs, I am prompted to enter the value, in this case the date, for 'lValue'.</p>
  
  <p>I tried adding the <code>Format(Transaction_Date, "mm/dd/yyyy")</code> into the select query, but the quotes in the format function would make the whole row seem like it was all text.</p>