Need help in running report, no data uploaded!!!!

  • Thread starter Thread starter g
  • Start date Start date
G

g

Hi Experts,

First of all thank you for reading my question and most of all giving a help.

This is my problem: I have a data entry form with a button that once it
click it will run a report and will direct to an email with the report
attached. The report source is base on a query, the query has a criteria base
on one of field on the form( Example Field Name: Txt_IDNumber). So, what ever
currently entered data on the form it has to populate to the report. The
process directing and attaching the report works fine but the report doesn't
generate data.The form still active while doing the process.

My query criteria: Like [Forms]![NameOfMyForm]![Txt_IDNumber]


'Code to email and attached the report.
stDocName = "ReportName"
DoCmd.SendObject acReport, stDocName, "Snapshot Format",
"(e-mail address removed)", , , "Email Subject", "Email Context"

Thanks Again
 
Try to save the record first using me.refresh before you run those commands.

'Code to email and attached the report.
stDocName = "ReportName"

me.refresh
DoCmd.SendObject acReport, stDocName, "Snapshot Format",
"(e-mail address removed)", , , "Email Subject", "Email Context"
 
Thanks Jae. That works

Jae said:
Try to save the record first using me.refresh before you run those commands.

'Code to email and attached the report.
stDocName = "ReportName"

me.refresh
DoCmd.SendObject acReport, stDocName, "Snapshot Format",
"(e-mail address removed)", , , "Email Subject", "Email Context"


g said:
Hi Experts,

First of all thank you for reading my question and most of all giving a help.

This is my problem: I have a data entry form with a button that once it
click it will run a report and will direct to an email with the report
attached. The report source is base on a query, the query has a criteria base
on one of field on the form( Example Field Name: Txt_IDNumber). So, what ever
currently entered data on the form it has to populate to the report. The
process directing and attaching the report works fine but the report doesn't
generate data.The form still active while doing the process.

My query criteria: Like [Forms]![NameOfMyForm]![Txt_IDNumber]


'Code to email and attached the report.
stDocName = "ReportName"
DoCmd.SendObject acReport, stDocName, "Snapshot Format",
"(e-mail address removed)", , , "Email Subject", "Email Context"

Thanks Again
 
Back
Top