Turning off warnings often covers up a problem. Perhaps the record isn't being added as you say. On the other hand, maybe you have the table open when this runs and when you activate that window again you're not seeing the addition. You would have to refresh the view.
Better to use the Execute method of the CurrentDb object and include the parameter to provide a warning. Since you've declared and set the CurrentDb object, it would look like
Code:
db.Execute (your sql statement or variable goes here), dbFailOnError
. Otherwise, don't turn off warnings and see what happens.
Please use code tags for anything more than a few lines. Note also that long code segments tend to get broken apart by this forum, so spaces may appear where you have none, so that's another reason to use them.
Also, with respect to Dim strEmail, strBody, userdept, authgroupemail, currenttime, crntusername, expr As String
the only thing that is a string variable here is expr. All the rest are of the Variant type because you have not explicitly declared them. It's not how to make multiple declarations on one line:
Dim strEmail As String, strBody As String, userdept As String, authgroupemail As String, currenttime As String, crntusername As String, expr As String
(assumes all were supposed to be strings)
I would break the above onto at least 2 lines.
You might also want to check out how to use the Select Case block rather than so many If's.
Last edited by Micron; 11-19-2017 at 08:21 PM.
Reason: clarification
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.