title: MS Access - Module - VBA - Compile Error : Expected Idenitifier - Table with Spaces in Name
body: <p>I have a table that I am trying to write a module that will go in and add two columns to an existing table. I have a table that has existing spaces in the name and I get an error of Compile Error : Expected Identifier.</p>
  
  <pre><code>Private Sub AddColumn()
  Dim curDatabase As Database
  Dim [Final LOS and PAPW TABLE] As TableDef
  Dim Yrs_of_Svc As Field
  Dim Yrs_of_Svc_Cat As Field
  
  
  ' Get a reference to the current database
   Set curDatabase = CurrentDb
  
  ' Get a reference to a table named TestTable - NOTE: The table MUST exist
   Set [Final LOS and PAPW TABLE] = curDatabase.TableDefs("[Final LOS and PAPW TABLE]")
  
  'define the fields using the CreateField method
  ' Syntax: .CreateField("FIELD NAME", TYPE, [Length])
  ' I used the predefined types already in Access
   Set Yrs_of_Svc = [Final LOS and PAPW TABLE].CreateField("Yrs_of_Svc", dbDouble, 5)
   Set Yrs_of_Svc_Cat = [Final LOS and PAPW TABLE].CreateField("Yrs_of_Svc_Cat", dbText, 2)
  
   If Len(Offc_TRMN_DT) &gt; 1 Then
      [Final LOS and PAPW TABLE].Yrs_of_Svc = [Final LOS and PAPW TABLE].Offc_TRMN_DT - [Final LOS and PAPW TABLE].Offc_EMPLMT_DT
   Else
      [Final LOS and PAPW TABLE].Yrs_of_Svc = [Final LOS and PAPW TABLE].BSE_ISS_RGST_DT - [Final LOS and PAPW TABLE].Offc_EMPLMT_DT
   End If
  
  
   Select Case Yrs_of_Svc    ' Evaluate Number.
  
   Case 0 To 1.99
      [Final LOS and PAPW TABLE].Yrs_of_Svc_Cat = 1
  
   Case 2.01 To 2.99
      [Final LOS and PAPW TABLE].Yrs_of_Svc_Cat = 2
  
   Case 3.01 To 3.99
      [Final LOS and PAPW TABLE].Yrs_of_Svc_Cat = 3
  
   Case 4.01 To 4.99
      [Final LOS and PAPW TABLE].Yrs_of_Svc_Cat = 4
  
   Case Is &gt; 5#
      [Final LOS and PAPW TABLE].Yrs_of_Svc_Cat = 5+
  
   End Select
  
  
  
   End Sub
  </code></pre>
  
  <p>Thank you for your help.</p>
  
  <p>Robert</p>