I'm still very "wet behind the ears" when it comes to VBA, but could someone please tell me what's wrong with my code? This procedure is designed so that, if users attempt to open the database before 7:30 am, thus opening the switchboard, it will tell them they aren't allowed in, send me an email telling me they tried to enter, and shut it down. It is giving me the runtime error I put below the code...
Private Sub Form_Load()
If Me.Time < #7:30:00 AM# And Me.Time > #4:00:00 AM# Then
MsgBox "You are not allowed in the database before 7:30 a.m."
DoCmd.SendObject , "", "", "[my email address]", "", "", "Unauthorized Database Entry", "Auto Message: The person from whom this message was sent attempted to enter the database at a time reserved for administration.", False, ""
DoCmd.Quit
End If
End Sub
This gives "runtime error 2293. [Database name] can't send a message for the reason stated in the preceding alert." What "preceding alert" it's talking about I haven't the foggiest idea. Anyway, any help is appreciated.
Private Sub Form_Load()
If Me.Time < #7:30:00 AM# And Me.Time > #4:00:00 AM# Then
MsgBox "You are not allowed in the database before 7:30 a.m."
DoCmd.SendObject , "", "", "[my email address]", "", "", "Unauthorized Database Entry", "Auto Message: The person from whom this message was sent attempted to enter the database at a time reserved for administration.", False, ""
DoCmd.Quit
End If
End Sub
This gives "runtime error 2293. [Database name] can't send a message for the reason stated in the preceding alert." What "preceding alert" it's talking about I haven't the foggiest idea. Anyway, any help is appreciated.