How to email a report for a current record

  • Thread starter Thread starter Christine
  • Start date Start date
C

Christine

Dear Helpful People,

I read Cheryl Fisher's response of 26-Feb to Jim S.
concerning Jim's question about sending a current report
via Email, and have taken her advice for my own
situation, but am still having difficulties getting a
report for the correct record. It may not matter that I'm
tring to email the report, since it doesn't work even
without the email, but I'm including the email bits so
the context is complete.

I have a data entry form called frmServiceRequests. From
there, the following code executes:

DoCmd.SendObject acSendReport, "rptRequestNotice",
acFormatRTF, _
strToAddress, , , _
"Service Request for Your Review", _
"Message text", , False

It works fine except the wrong report appears in the
email attachment. (Note it doesn't work even just opening
the report to the screen.)

The report (rptRequestNotice) is based on
qryRequestNotice, where the Criteria is set to:
"ServiceNum"=[Forms]![ServiceRequests]![ServiceNum])

This doesn't work: A box appears asking for Parameter
Values.

So, I've tried removing the criteria from
qryRequestNotice and putting the following into the
report (rptRequestNotice):

Record Source: qryServiceRequests
Filter: (ServiceNum = Forms![frmServiceRequests]!
ServiceNum)

That doesn't work either.

I've tried storing ServiceNum as a Public Variable in
frmServiceRequests and making the appropriate changes in
the query/report -- again, to no avail.

Can someone please tell me....What AM I doing wrong??

PS: I've included the information for the email because,
although False is set so the Outlook dialog doesn't
appear, it still does. I've posted a separate question to
this, but if there is anyone who knows what's up with
this in this post, I'd be mucho obliged!

Ta,
Christine
 
Hello Christine,
The report (rptRequestNotice) is based on
qryRequestNotice, where the Criteria is set to:
"ServiceNum"=[Forms]![ServiceRequests]![ServiceNum])

This doesn't work: A box appears asking for Parameter
Values.

When an Access query which does not use a Parameter asks for one, this
usually means that it cannot resolve a criteria statement. If you want your
query to use the value of ServiceNum on your form, the Criteria: row in
the Column for ServiceNum (in your Query's design view) should contain
*only* the following:

[Forms]![ServiceRequests]![ServiceNum]

Before you test this out, be sure to remove your other filter from the
Report's properties. Give that a try and let us know of your results.

hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Christine said:
Dear Helpful People,

I read Cheryl Fisher's response of 26-Feb to Jim S.
concerning Jim's question about sending a current report
via Email, and have taken her advice for my own
situation, but am still having difficulties getting a
report for the correct record. It may not matter that I'm
tring to email the report, since it doesn't work even
without the email, but I'm including the email bits so
the context is complete.

I have a data entry form called frmServiceRequests. From
there, the following code executes:

DoCmd.SendObject acSendReport, "rptRequestNotice",
acFormatRTF, _
strToAddress, , , _
"Service Request for Your Review", _
"Message text", , False

It works fine except the wrong report appears in the
email attachment. (Note it doesn't work even just opening
the report to the screen.)

The report (rptRequestNotice) is based on
qryRequestNotice, where the Criteria is set to:
"ServiceNum"=[Forms]![ServiceRequests]![ServiceNum])

This doesn't work: A box appears asking for Parameter
Values.

So, I've tried removing the criteria from
qryRequestNotice and putting the following into the
report (rptRequestNotice):

Record Source: qryServiceRequests
Filter: (ServiceNum = Forms![frmServiceRequests]!
ServiceNum)

That doesn't work either.

I've tried storing ServiceNum as a Public Variable in
frmServiceRequests and making the appropriate changes in
the query/report -- again, to no avail.

Can someone please tell me....What AM I doing wrong??

PS: I've included the information for the email because,
although False is set so the Outlook dialog doesn't
appear, it still does. I've posted a separate question to
this, but if there is anyone who knows what's up with
this in this post, I'd be mucho obliged!

Ta,
Christine
 
Many thanks, Cheryl - works perfectly!!

Christine
-----Original Message-----
Hello Christine,
The report (rptRequestNotice) is based on
qryRequestNotice, where the Criteria is set to:
"ServiceNum"=[Forms]![ServiceRequests]![ServiceNum])

This doesn't work: A box appears asking for Parameter
Values.

When an Access query which does not use a Parameter asks for one, this
usually means that it cannot resolve a criteria statement. If you want your
query to use the value of ServiceNum on your form, the Criteria: row in
the Column for ServiceNum (in your Query's design view) should contain
*only* the following:

[Forms]![ServiceRequests]![ServiceNum]

Before you test this out, be sure to remove your other filter from the
Report's properties. Give that a try and let us know of your results.

hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Dear Helpful People,

I read Cheryl Fisher's response of 26-Feb to Jim S.
concerning Jim's question about sending a current report
via Email, and have taken her advice for my own
situation, but am still having difficulties getting a
report for the correct record. It may not matter that I'm
tring to email the report, since it doesn't work even
without the email, but I'm including the email bits so
the context is complete.

I have a data entry form called frmServiceRequests. From
there, the following code executes:

DoCmd.SendObject acSendReport, "rptRequestNotice",
acFormatRTF, _
strToAddress, , , _
"Service Request for Your Review", _
"Message text", , False

It works fine except the wrong report appears in the
email attachment. (Note it doesn't work even just opening
the report to the screen.)

The report (rptRequestNotice) is based on
qryRequestNotice, where the Criteria is set to:
"ServiceNum"=[Forms]![ServiceRequests]![ServiceNum])

This doesn't work: A box appears asking for Parameter
Values.

So, I've tried removing the criteria from
qryRequestNotice and putting the following into the
report (rptRequestNotice):

Record Source: qryServiceRequests
Filter: (ServiceNum = Forms![frmServiceRequests]!
ServiceNum)

That doesn't work either.

I've tried storing ServiceNum as a Public Variable in
frmServiceRequests and making the appropriate changes in
the query/report -- again, to no avail.

Can someone please tell me....What AM I doing wrong??

PS: I've included the information for the email because,
although False is set so the Outlook dialog doesn't
appear, it still does. I've posted a separate question to
this, but if there is anyone who knows what's up with
this in this post, I'd be mucho obliged!

Ta,
Christine


.
 
Back
Top