title: Access Buttons VBA Problems and Subform Issues
body: <p>Im working on a key inventory database. Something to manage who signs out room keys and when they bring them back in. I've created the tables I plan on using and have started working on the forms. However, I am having trouble getting the forms/subforms to work as desired. </p>
  
  <p>I've created buttons to add/edit/delete/etc the records in the subform which are a result of the tables. I've coded the buttons based on an old project I did in my DB class (someone else did the forms then, I did queries). I can't seem to get them working. So far, I've only coded the buttons for "mainKeys" form so far. </p>
  
  <p>I've noticed the main form shows 1 of 14 records whereas the forms from my old project only showed all records in the subforms. </p>
  
  <p>Here's the Access file: <a href="http://jumpshare.com/b/W7AKih" rel="nofollow">http://jumpshare.com/b/W7AKih</a></p>
  
  <p>Here's my old project (this is what im trying to copy): <a href="http://jumpshare.com/b/r7Y6O1" rel="nofollow">http://jumpshare.com/b/r7Y6O1</a></p>
  
  <p>Here's the code for the buttons: </p>
  
  <pre><code>Option Compare Database
  
  Private Sub cmdAdd_Click()
  If Me.keyID.Tag &amp; "" = "" Then
      CurrentDb.Execute "INSERT INTO KEYS(KEY_ID, ROOM, DRAWER)" &amp; _
          " VALUES(" &amp; Me.keyID &amp; ",'" &amp; Me.roomID &amp; "'," &amp; Me.drawerID &amp; ")"
            subKey.Form.Requery
  Else
      CurrentDb.Execute "UPDATE KEYS " &amp; _
      " SET KEY_ID=" &amp; Me.keyID &amp; _
      ", ROOM='" &amp; Me.roomID &amp; "'" &amp; _
      ", DRAWER='" &amp; Me.drawerID &amp; "'" &amp; _
      " WHERE KEY_ID=" &amp; Me.keyID.Tag
  End If
  cmdReset_Click
  subKey.Form.Requery
  End Sub
  
  Private Sub cmdBack_Click()
  
  End Sub
  
  Private Sub cmdDelete_Click()
  If Not (Me.subKey.Form.Recordset.EOF And Me.subKey.Form.Recordset.BOF) Then
      If MsgBox("Confirm Deletion?", vbYesNo) = vbYes Then
          CurrentDb.Execute "DELETE FROM KEYS" &amp; _
              " WHERE KEY_ID=" &amp; Me.subKey.Form.Recordset.Fields("KEY_ID")
                  Me.subKey.Form.Requery
      End If
  End If
  End Sub
  
  Private Sub cmdEdit_Click()
  If Not (Me.subKey.Form.Recordset.EOF And Me.subKey.Form.Recordset.BOF) Then
          With Me.subKey.Form.Recordset
              Me.keyID = .Fields("KEY_ID")
              Me.roomID = .Fields("ROOM")
              Me.drawerID = .Fields("DRAWER")
              Me.keyID.Tag = .Fields("KEY_ID")
              Me.cmdAdd.Caption = "Update Record"
              Me.cmdEdit.Enabled = False
          End With
  End If
  End Sub
  
  Private Sub cmdExit_Click()
   DoCmd.Close
  End Sub
  
  Private Sub cmdReset_Click()
      Me.keyID = ""
      Me.roomID = ""
      Me.drawerID = ""
  
      Me.keyID.SetFocus
      Me.cmdEdit.Enabled = True
      Me.cmdAdd.Caption = "ADD KEY"
      Me.keyID.Tag = ""
  End Sub
  </code></pre>
  
  <p>From what I can see the Reset &amp; Exit buttons work just fine, the add/delete/update records do not. 
  Also, this is a small project I am working on for an office in my school. If anyone has any recommendations from what they see in the file that would be great.</p>