title: Access VBA code format updating table using form and subform
body: <p>I am currently learning access and VBA at the moment . I am trying to update table in My access 2013 database using a form which also has a sub form embedded in to it. The table is called exam categories and has two fields both are text fields called ExamCatCode and ExamDescription. I have created a delete button on the form which would delete the record that is selected on the subform which displays the results of table. Previously I had ExamCatCode as a number format field and I was using the following code to delete the record:</p>
  
  <p>CurrentDb.Execute "Delete from ExamCategories " &amp; _
                  " WHERE ExamCatCode=" &amp; Me.ExamCategoriesSubform.Form.Recordset.Fields("ExamCatCode")</p>
  
  <p>Now that I have changed the ExamCatCode to text format field the code is not working, I presume that I am missing a quote or an apostrophe somewhere, can some please set me straight. Thank you</p>