title: Need Help in following MS Access 2010 VBA Code
body: <p>i am using this code and its not showing any error but not storing entered data into table.</p>
  
  <pre><code>Private Sub Command21_Click()
  Dim db As DAO.Database
  Dim rs As DAO.Recordset
  Dim strSQL As String, strItem As String
  
  strSQL = "SELECT hotel_ID, Hotel_Name FROM hotels"
  Set db = CurrentDb
  Set rs = db.OpenRecordset(strSQL)
  
  rs.AddNew
     ' rs.Fields("Hotel_ID") = frmHotel_ID          Hotel_ID is a autonumber field
      rs.Fields("Hotel_Name") = frmHotel_Name
  rs.Close
  Set rs = Nothing
  Set db = Nothing
  
  End Sub
  </code></pre>