我正在使用此代码,它没有显示任何错误,但没有将输入的数据存储到表中。
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