title: Microsoft Access VBA for opening different Form based conditional string in column of table
body: <p>obligatory mention that I have little understanding of VBA:</p>
  <p>I have a table with data that needs to be displayed through one of two different Forms based on the value of a column within the table, after a command is run/button clicked.</p>
  <p>The data is housed in the same table, but needs separate forms to display differently based on the value of the column.
  Reference:</p>
  <p><strong>Table</strong>  master_schools_tbl</p>
  <p><strong>column</strong>  school</p>
  <p><strong>Form 1</strong> East_Town_High_frm</p>
  <p><strong>Form 2</strong>  West_Town_High_frm</p>
  <p>Apologies for lack of basic syntax knowledge, and below was my final attempt and I understand its weird to use a condition to then set that same condition.</p>
  <p>example code I cant get to work-</p>
  <pre><code>Dim stDocName as string
  Dim stLinkCriteria as string
  
  
  If [school] = &quot;East&quot; Then 
  stDocName=&quot;East_Town_High_frm&quot; 
  stLinkCriteria=&quot;[School]='East'&quot;
  ElseIF [school] = &quot;West&quot; Then 
  stDocName=&quot;West_Town_High_frm&quot; 
  stLinkCriteria=&quot;[School]='West'&quot;
  EndIf
  
  DoCmd.OpenForm stDocName,,,stLinkCriteria
  </code></pre>