0

我正在使用此代码,它没有显示任何错误,但没有将输入的数据存储到表中。

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
4

1 回答 1

0

您是否错过了对 .Update 的调用?

于 2013-09-11T04:26:50.810 回答