I have a form that shows records that match the users input parameter. On this form I've created a button with the following VBA Sub:
The purpose is to open an email with all the emails copied into the BCC box on the email. This sub works fine on one form (ContactSearch), however when I copy it over to another very similar form (KeywordForm) I get the Item not found error.
The only difference in the forms that might be relevant is that the KeywordSearch query uses a table with multi-valued fields (I know this is bad form, I didn't make it and will figure out how to change it a later date). I've checked the name of the Form/Field and everything is spelt correctly.
Could the issue be related to different subs using RecordsetClones?
Thanks for any help/suggestions!
Code:
Private Sub Send_Email_Click()
Dim rs As DAO.Recordset
Dim bcc As String
Set rs = Forms!KeywordSearch.RecordsetClone
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!Email) Then
bcc = bcc & rs!Email & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
DoCmd.SendObject acSendNoObject, , , "", , bcc, , , True
End If
End Sub
The purpose is to open an email with all the emails copied into the BCC box on the email. This sub works fine on one form (ContactSearch), however when I copy it over to another very similar form (KeywordForm) I get the Item not found error.
The only difference in the forms that might be relevant is that the KeywordSearch query uses a table with multi-valued fields (I know this is bad form, I didn't make it and will figure out how to change it a later date). I've checked the name of the Form/Field and everything is spelt correctly.
Could the issue be related to different subs using RecordsetClones?
Thanks for any help/suggestions!