The following code is the issue:
CN.Execute (“INSERT INTO tblHistory ” _
& “(UserName, TermID, ActionDate, ActionDone, Msg) ” _
& “VALUES (‘” & OSInfo.UserName & “‘, ” _
& “‘” & OSInfo.ComputerName & “‘, ” _
& “‘” & Now() & “‘, ” _
& “‘Page Sent to: ” & sWhereClause & “‘, ” _
& “‘” & TDBMessage.Text & “‘)”)
The issue is sWhereClause, when it consists of multiple users, the values are separated by commas. The SQL statement reads this as part of the Insert statement and returns an error that the number of fields don’t match.
Is there a way I package that whole & “‘Page Sent to: ” & sWhereClause & “‘, ” so it inserts into one field?
This is a Debug.Print of that line containing the values it resolved to:
‘Page Sent to: Shea, Michael’ , ‘Sprague, Chris’