When the Command Button "Notify" is clicked, I am wanting to send out an email to the user with appropriate information in the email (works great), check the "Notified" check box (does not work), and disable the "Notify" button (works).
After the email is sent off, i get a Data type mismatch in criteria expression error. I am completely stumped. Any help would be greatly appreciated! Here is my code (I removed the email portion as it is working fine)... Thanks in advance!
I am working with Access 2003
After the email is sent off, i get a Data type mismatch in criteria expression error. I am completely stumped. Any help would be greatly appreciated! Here is my code (I removed the email portion as it is working fine)... Thanks in advance!
I am working with Access 2003
Code:
Private Sub Notify_Click() On Error GoTo Err_Notify_Click Dim stWhere As String '-- Criteria for DLookup Dim varTo As Variant '-- Address for SendObject Dim stText As String '-- E-mail text Dim RecDate As Variant '-- Rec date for e-mail text Dim stSubject As String '-- Subject line of e-mail Dim stTicketID As String '-- The ticket ID from form Dim Method As String '-- Method of Delivery Information Dim stWho As String '-- Reference to tblUsers Dim strSQL As String '-- Create SQL update statement Dim errLoop As Error 'Set the update statement to disable command button 'once e-mail is sent strSQL = "UPDATE Requests SET Requests.Notified = -1 " & _ "Where Requests.CauseNo = " & Me.CauseNo & ";" Debug.Print strSQL On Error GoTo Err_Execute CurrentDb.Execute (strSQL) On Error GoTo 0 'Requery checkbox to show checked 'after update statement has ran 'and disable send mail command button Me.Notified.Requery Me.Notified.SetFocus Me.Notify.Enabled = False Exit Sub Err_Execute: ' Notify user of any errors that result from ' executing the query. If DBEngine.Errors.Count > 0 Then For Each errLoop In DBEngine.Errors MsgBox "Error number: " & errLoop.Number & vbCr & _ errLoop.Description Next errLoop End If Resume Next Exit_Notify_Click: Exit Sub Err_Notify_Click: MsgBox Err.Description Resume Exit_Notify_Click End Sub
Comment