Form Coding Help - Emailing a Snapshot file.

B

BaWork

I'm using the following code to set the report name of a snapshot file
on save and it works perfectly.

*************************

Private Sub cmd_save_report_Click()
On Error GoTo Err_cmd_save_report_Click

Dim stDocName As String

stDocName = first_name & "_" & last_name & "_resume"
DoCmd.OutputTo acReport, stDocName, acFormatSNP

Exit_cmd_save_report_Click:
Exit Sub

Err_cmd_save_report_Click:
MsgBox Err.Description
Resume Exit_cmd_save_report_Click

End Sub

*************************

If I transfer the same coding logic to send a snapshot file through
email, I get the following error:

"The report name "first_last_resume" you entered in either the property
sheet or macro is misspelled or refers to a report that doesn't exist."

Here is my current code.

*******************************

Private Sub cmd_email_report_Click()
On Error GoTo Err_cmd_email_report_Click

Dim stDocName As String

stDocName = first_name & "_" & last_name & "_resume"
DoCmd.SendObject acReport, stDocName, acFormatSNP

Exit_cmd_email_report_Click:
Exit Sub

Err_cmd_email_report_Click:
MsgBox Err.Description
Resume Exit_cmd_email_report_Click

End Sub

*******************************

Thanks

Brett
 
B

BaWork

Please ignore previous posted question, I was mistaken on the first
point, it doesn't completely work.

Here is the corrected question:

How do I preset the name of the snapshot file that is either getting
saved to a file or emailed as an attachment? I want to pull the first
and last name from the form and name the file "firtname_lastname.snp".
Here is the correct code that Access generates without the feature of
presetting the file name:

*************************

Private Sub cmd_save_report_Click()
On Error GoTo Err_cmd_save_report_Click

Dim stDocName As String

stDocName = "rpt_resume"
DoCmd.OutputTo acReport, stDocName, acFormatSNP

Exit_cmd_save_report_Click:
Exit Sub

Err_cmd_save_report_Click:
MsgBox Err.Description
Resume Exit_cmd_save_report_Click

End Sub

**************************

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top