I am receiving a runtime error when I try to run a piece of code. The first time I ran the code it worked well. Now everytime I click on the button the code is attached to, I get this message:
Run-time Error '3201':
You cannot add or change a record because a related record is required in table 'subtaskorders.'
Here is the code:
Private Sub cmdAdd_Click()
Dim strSql As String
strSql = "INSERT INTO Activities (ActTypeID, ActDesc, StoID, ToID) VALUES (" & Me.lsttype & ", '" & Me.txtactdesc & "', " & Me.cmbSTO & ", " & Me.cmbTO & ")"
CurrentDb.Execute strSql, dbFailOnError
The part that is highlighted in the debugging is the line right before End Sub.
I have attached a copy of the database because it is almost always necessary.
Thank you, in advance, for the help!