Hi
Apologies this is likely to be a stupid question, total novice with VBA.
What I'm trying to do is create a new record in a link table and populate it with TaskNo and TaskOwnerRef. TaskNo is selected on the ST3TaskLogfrm form and then opens subform FrmMultiStaff where the TaskOwnerRef is selected and I am using a command button on the subform to add this to the link table.
This is the code Im using for the command button to add a new record and populate.
Private Sub cmdAddStaffToTask_Click()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("TblTaskOwnerLink", dbOpenDynaset)
rst.AddNew 'this adds the new record to the table
rst!TaskNo = [Forms!ST3TaskLogfrm]
rst!TaskOwnerRef = [Me!TaskOwnerRef]
rst.Update
rst.Close
End Sub
The code was inherited with the project and I havn't had chance to build any error handlying into it yet.
I am getting Compile Error: User defined type not defined.
Any help would be grand.
Apologies this is likely to be a stupid question, total novice with VBA.
What I'm trying to do is create a new record in a link table and populate it with TaskNo and TaskOwnerRef. TaskNo is selected on the ST3TaskLogfrm form and then opens subform FrmMultiStaff where the TaskOwnerRef is selected and I am using a command button on the subform to add this to the link table.
This is the code Im using for the command button to add a new record and populate.
Private Sub cmdAddStaffToTask_Click()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("TblTaskOwnerLink", dbOpenDynaset)
rst.AddNew 'this adds the new record to the table
rst!TaskNo = [Forms!ST3TaskLogfrm]
rst!TaskOwnerRef = [Me!TaskOwnerRef]
rst.Update
rst.Close
End Sub
The code was inherited with the project and I havn't had chance to build any error handlying into it yet.
I am getting Compile Error: User defined type not defined.
Any help would be grand.