Hi, I want to be able to insert 5 records from a form into a table named employees, I keep getting an error message saying I cant reference a property or method unless the control has the focus. Ive included the code below. Im using Access 2000
Private Sub CmdAdd_Click()
Dim dbsJH As Database
Dim rstEmployees As Recordset
Set dbsJH = CurrentDb
Set rstEmployees = dbsJH.OpenRecordset("Employees", dbOpenDynaset)
With rstEmployees
.AddNew
!ID = txtID.Value
!Surname = txtSurname.Text
!Forename = txtForename.Text
!Age = txtAge.Text
!Update = txtUpdate.Text
.Update
.Close
End With
End Sub
Thanks in advance
Paul
Private Sub CmdAdd_Click()
Dim dbsJH As Database
Dim rstEmployees As Recordset
Set dbsJH = CurrentDb
Set rstEmployees = dbsJH.OpenRecordset("Employees", dbOpenDynaset)
With rstEmployees
.AddNew
!ID = txtID.Value
!Surname = txtSurname.Text
!Forename = txtForename.Text
!Age = txtAge.Text
!Update = txtUpdate.Text
.Update
.Close
End With
End Sub
Thanks in advance
Paul