Hi
I am trying to add values from a form to a table using recordsets.
I keep getting this error object variable or with block vairable not set.
Heres my code...
Private Sub cmdsave_Click()
Dim rststudent As DAO.Recordset
Set rststudent = dbase.OpenRecordset("Student")
rststudent.AddNew
'copy data from text boxes into the member table
rstAddMember("MemberNo") = newNumber("M")
rststudent("FirstName") = txtName.Value
rsttblstudent("Title") = cboTitle.Value
rsttblstudent("DateOfBirth") = cboDateOfBirth.Value
rsttblstudent("Address") = txtAddress.Value
rsttblstudent("City") = txtCity.Value
rsttblstudent("PostCode") = txtPostCode.Value
'update the table(s) the record set refers to in the database
rststudent.Update
rsttblstudent.Bookmark = rsttblstudent.LastModified
End Sub
I am trying to add values from a form to a table using recordsets.
I keep getting this error object variable or with block vairable not set.
Heres my code...
Private Sub cmdsave_Click()
Dim rststudent As DAO.Recordset
Set rststudent = dbase.OpenRecordset("Student")
rststudent.AddNew
'copy data from text boxes into the member table
rstAddMember("MemberNo") = newNumber("M")
rststudent("FirstName") = txtName.Value
rsttblstudent("Title") = cboTitle.Value
rsttblstudent("DateOfBirth") = cboDateOfBirth.Value
rsttblstudent("Address") = txtAddress.Value
rsttblstudent("City") = txtCity.Value
rsttblstudent("PostCode") = txtPostCode.Value
'update the table(s) the record set refers to in the database
rststudent.Update
rsttblstudent.Bookmark = rsttblstudent.LastModified
End Sub