title: Insert a record into table in ms access
body: <p>I need to create a small "application" using ms access 2007. All I need is to create a form that will take care of input/output related to a few db tables. 
  I created the tables: patients, treatments and labresults.</p>
  
  <p>Primary key in patients table is ID, and it serves as a foreign key in treatments and labresults tables, where it is named patientID.</p>
  
  <p>I also created a form that I mentioned in the beginning of this question. It has multiple tabs. 1st tab opens/creates the patient, and the second one is used to enter data that is to be entered into the labresults table. Same applies to treatments table.</p>
  
  <p>My problem: <code>I added a button to the 2nd tab, and I want to attach an 'action' that will set an INSERT query with values taken from fields (controls) in tab 2, together with ID field taken from tab1 (that corresponds with patient ID from patients table), and then execute a query.</code></p>
  
  <p>Right now I'm trying to achieve this myself, but with little success. Also, searchin MS site for solution(s) is kind of hard, since it always show results that have 'query' in it :)... And query isn't smt I want to use. (However, I'll accept any solution).</p>
  
  <p>Thx</p>
  
  <p>Tables: </p>
  
  <p><b>patients</b></p>
  
  <pre><code>ID - primary key, autogenerated
  patientID - internal number of the patient record. I could've used this, but it would complicate my life later on :)
  gender
  age
  dateOfDiagnose
  </code></pre>
  
  <p>- field names are actually in Serbian, but field names aren't that much important</p>
  
  <p><b>labtests</b></p>
  
  <pre><code>ID - primary key
  patientID - foreign key, from patients table
  ... bunch of numerical data :)
  </code></pre>
  
  <p>There are 2 more tables, but they basically reflect some additional info and are not as important.</p>
  
  <p>My form needs to enable user to enter data about the patient, and then enter several rows in labtests table, as treatment progresses. There are 2 types of treatment, and there is a table related to that, but they only have few fields in it, containint info about the start of the treatment, and the rest is info about lab tests.</p>