SteveL13
asked on
Why getting an error when click a checkbox
I am getting an error... "Argument not optional" when I click on a checkbox to make it true. The onclick code is:
And the module code to send the email is:
Private Sub chkbxTranscriptionComplete_Click()
If Me.chkbxDataComplete = True Then
If MsgBox("An email will be sent to the assistant to let them know the data has been completed. Do you wish to continue?", vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
SendEmailOutlook "somebody@somewhere.com", "Data Complete" & " - " & Me.txtFirstName & " " & Me.txtLastName, "The data has been entered for " & Me.txtFirstName & " " & Me.txtLastName & ". "
End If
End If
End Sub
And the module code to send the email is:
Public Sub SendEmailOutlook(strTo As String, strSubject As String, strBody As String, _
strFile As String, Optional bFileAttach As Boolean = False, Optional bPreview As Boolean = False)
On Error GoTo SendEmailOutlookErr
Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
'.ReplyRecipients.Add "ben@accessdatabasetutorial.com"
.to = strTo
'.body = sBody
.htmlbody = strBody
.Subject = strSubject
' If strFile <> "" Then
' .Attachments.Add (strFile)
' End If
' If bFileAttach = True Then
' 'THIS IS WHERE YOU CODE YOUR FORM TO ATTACH FILE(S)...
' '.Attachments.Add (CurrentProject.Path & "XYZ.XXX")
' End If
If bPreview = True Then
.display
Else
.Send
End If
End With
If bPreview = False Then
Set oMail = Nothing
Set oLook = Nothing
End If
Exit Sub
SendEmailOutlookErrExit:
Exit Sub
SendEmailOutlookErr:
MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
Resume SendEmailOutlookErrExit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER