alfiajamel said:
Good Morning,
This is the code that I am using:
Private Sub cmdSubmit_Click()
DoCmd.SendObject acReport, "qryMovementPreviewReport",
"SnapshotFormat(*.snp)", "[Forms]![frmGeneralMovement]![txtCurrentEmail]",
"[Forms]![frmGeneralMovement]![txtNewEmail]", "", "Movement Review",
"Please
review the movement listed below.", False, ""
End Sub
It is giving me an error message stating the email address is unknown.
Would someone be able to tell me what's wrong with the code. Also, how
could
I generate an error message so that my usere would not be given the option
to
debug?
Thanks,
Alfia
When you do this:
"[Forms]![frmGeneralMovement]![txtCurrentEmail]"
you're literally sending the string
"Forms![frmGeneralMovement]![txtCurrentEmail]" as the email address. What
you want is the contents of the txtCurrentEmail field, so remove the quotes:
DoCmd.SendObject acReport, "qryMovementPreviewReport",
"SnapshotFormat(*.snp)", [Forms]![frmGeneralMovement]![txtCurrentEmail],
[Forms]![frmGeneralMovement]![txtNewEmail], "", "Movement Review", "Please
review the movement listed below.", False, ""
Note that if this code is running in the form frmGeneralMovement, you can
simplify this as:
DoCmd.SendObject acReport, "qryMovementPreviewReport",
"SnapshotFormat(*.snp)", Me.txtCurrentEmail, Me.txtNewEmail, "", "Movement
Review", "Please review the movement listed below.", False, ""
As for your other question, you should be able to do something like:
On Error Resume Next
DoCmd.SendObject ...
If Err.Number <> 0 Then
' Do error handling here
End If
Carl Rapson