尝试使用按钮和文本框将记录输入到表中

时间:2016-08-02 13:33:19

标签: database vba ms-access

我正在努力让这段代码在MS Access中运行:

Private Sub BtnIssue_Click()

Dim db As Database
Dim rec As Recordset

Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from Current_Rentals")

rec.AddNew
rec("Game") = Me.Text85
rec("Game_Copy") = Me.Text77
rec("Member") = Me.Combo111
rec("Issue_Date") = Me.Text154
rec.Update

Set rec = Nothing
Set db = Nothing

End Sub

问题是Access抱怨编译错误,"用户定义的类型未定义"

1 个答案:

答案 0 :(得分:1)

Dim rec as dao.recordset
Set rec = db.openrecordset("current_rentals",dbopendynaset)