title: SSIS 2012 User Variable Not Found
body: <p>I hesitate to post because I feel I'm missing something simple, but after reading a ton of articles, I need a second set of eyes because mine are glazed over.</p>
  
  <p>SSIS 2012 Solution.</p>
  
  <p>Goal: Import data from 47 MS Access Databases into corresponding SQL Server databases.  This means 47 packages.  I want to avoid 47 different sets of Connection Managers and parameterize out what makes sense on the project level so common data is easily configurable.</p>
  
  <ul>
  <li><p>I added project-level Parameters to hold the SQL Server, SQL UserName, SQL Password, and the Path to the Access Databases.  These will be mapped out to the environment to allow changing the destination SQL Server easily as well as the source directory for the Access DBs.</p></li>
  <li><p>I added two project-level OLEDB Connection Managers - one for SQL 2012 (NativeClient 11.0), one for Access (MSJET 4.0) (they're access 2000 db's).  They are set to use an initial database configuration that I hope will be overridden by the individual packages.</p></li>
  <li><p>For each package, I want to specify the databases being used, so I create a Package Variable (SQLDatabase and AccessDatabase)</p></li>
  </ul>
  
  <p>In the Connection Managers, I add Expressions to include the Package Variable - e.g. for InitialCatalog on the SQL Connection Manager = @[User::SQLDatabase] and the ServerName in the Access CM combines the project path + the @[User::AccessDatabase]</p>
  
  <p>WHAT WORKS:  </p>
  
  <ul>
  <li>I can update the Package Variable values and see them reflected in the Properties of the Connection Managers.</li>
  <li>I can go into the Data Flow and add an OLE DB Source, select the SQL Connection Manager, and successfully receive a list of tables from that database.</li>
  </ul>
  
  <p>WHAT FAILS:</p>
  
  <p>When I click Preview, or Columns, after selecting a table I get a big error that reads:</p>
  
  <p><strong>"Error at Package1: The variable 'User::SQLDatabase' was not found in the Variables collection.  The variable might not exist in the correct scope."</strong> </p>
  
  <p>After clicking OK to that error, then the Preview or Column window shows up with no further problems.</p>
  
  <p>However, after clicking OK on the OLE DB Source Editor, there is a big red X sitting on the box indicating the same error as above.</p>
  
  <p>MY CONFUSION:</p>
  
  <p>If I open the Variables for the package, the variable is sitting right there, scoped to Package1.  If I update the value it and save, the Connection Manager updates itself accordingly, so the Expression mapping seems to be okay.</p>
  
  <p>It's as if this is only partially working, and I'm unsure where the flag is to make the rest of it work, or where I failed in my configuration.  Can you not set an expression in a project-level CM to use a package-level variable?  If that's the case, I'm at a loss on how to correctly set this up to avoid package-level CMs.</p>
  
  <p>Any help appreciated.  Please be gentle if I've been an idiot somewhere.</p>