title: Run-time error '3075' VBA: Check if file already exists in table
body: <p>I gave a piece of code where I am trying to check if a file has already been uploaded to a table. When files are uploaded the name of the file uploaded is put into a column called 'Name_of_report'. I am trying to run the below code and check if the file already exists in 'Table1' which holds all data.</p>
  
  <p>However when I run the below code I get the error: Run-time error '3075': Syntax  error (missing operator) in query expression 'Name_of_report' = File1. xlsx (which is the value assigned to the TableName variable)</p>
  
  <p>I know it's a simple fix but I'm very new to VBA and have tried various changes and can't seen to get it working.</p>
  
  <p>An help would be appreciated.</p>
  
  <pre><code>Sub Check_TableExists(TableName As Variant)
  If CurrentDb.OpenRecordset("SELECT count(Name_of_Report) FROM Table1 WHERE Name_of_Report =" &amp; TableName &amp; ";").Fields(0) &gt; 0 Then
      MsgBox ("Data already exists in table")
  End If
  </code></pre>