title: How to apply text formatting to a listbox in Microsoft Access using VBA?
body: <p>I would like to remove comma or period and capitalize the first letter of <code>last name</code>, I can only do with a <code>textbox</code> which I have to insert <code>last name</code> every time</p>
  
  <p>Here is my code for the <code>textbox</code>:</p>
  
  <pre><code>Private Sub Command2_DblClick(Cancel As Integer)
    Text19 = Trim(Text19)
  
    If Right(Text19, 1) = "." Or Right(Text19, 1) = "," Then 
      Text19 = Left(Text19, Len(Text19) - 1)
    End If
  
    Text19 = UCase(Left(Text19, 1)) &amp; Mid(Text19, 2)
  End Sub
  </code></pre>
  
  <p>How should the code be changed if I want to apply to a <code>listbox</code>?</p>