title: How do I create a loop in Access VBA/SQL to select records and output to Excel?
body: <p>I need some help on writing some VBA/SQL code into a module in Access, which should do the following:</p>
  
  <ul>
  <li><p>Loop through Table <strong>'Schools'</strong>, with just one field (<em>SchoolName</em>).</p></li>
  <li><p>Use each value in the first table to select records from Table <strong>'ChildData'</strong>, with several fields about individual children, including which school they attend (<em>SchoolName</em>).</p></li>
  <li><p>For each school, export the data for its attending children into a separate Excel workbook named for that school.</p></li>
  </ul>
  
  <p>Can anyone give me any starting points? Please be aware that I know very little about either VBA or SQL and am pretty much starting from scratch, therefore even the most basic explanations would be very helpful!</p>
  
  <p>Thanks,
  AVN</p>