title: Access VBA How to extract a text outside a [] from a String
body: <p>In an Access Form I can enter values in a TextBox called LenD. Sometimes I need to check the input code in order to split standard text from a code. For instance:</p>
  
  <p>noumnoum[codecode]</p>
  
  <p>To obtain:</p>
  
  <p>noumnoum</p>
  
  <p>So that, I use this:</p>
  
  <pre><code>If InStr(1, Me!LenD, "[") Then
              Me!LenD = Left(Mid(Me!LenD, InStr(1, Me!LenD, "[") + 1, (InStr(1, Me!LenteD, "]")) - (InStr(1, Me!LenD, "[")) - 1), 50)
          Else
              Me!LenD = Left(Me!LenD, 50)
  End If
  </code></pre>
  
  <p>But I just obtain the string inside the "[" "]". My aim would be to obtain the string that is on the left of the original String. Any idea on why it does not work?</p>