docmd.sendobject

S

Souris

I uses docmd.sendobject to email my reports as MS Word document.
it works but the report does not refresh it.
For example, I send an email for account numbber 111111 which works.
It keeps sending account number 111111 even I wnat to send account number
222222 information.

I have to close the access and re open it to send second email.

I can not find any command that I can refresh the report.
I close and reopen my query and use the debug which send the second account
number to the query.

Any ideas?

Your information is great appreciated,
 
S

Souris

Here is my code.
The code works for first time, but the report does not refresh when I run
second time.

Your help is great appreciated,

Set qdfCurr = CurrentDb().QueryDefs("MY_QUERY")

qdfCurr.SQL = "EXEC MY_STORE_PROCEDURE " & _
" @MYACCOUNTNUMBER = '" & Form_MYFORM.ACCOUNT_NUMBER & "'"


Report_MY_REPORT.Caption = "MY_REPORT " & Form_MYFORM.ACCOUNT_NUMBER & _
" for " & FormatDateTime(DATE, 1)



DoCmd.SendObject acSendReport, "MY_QUERY", acFormatRTF, _
(e-mail address removed), (e-mail address removed), , "MY REPORT " &
FormatDateTime(DATE, 1), " MY_REPORT " & FormatDateTime(DATE, 1) & Chr( _
13) & Chr(10) & MY_Msg, False
 
L

Leif

I'm not familar with this type of mail-merge, but don't you need a loop to
walk thru the recordset from the query? Could you create a loop, append the
results of each pass through the loop, and then send the consolidated final
report?

Leif
 
S

Souris

Thanks for the message,
I only need send out one email when user click the button.
It does not refresh when user click the second time.
It keeps the same result even user click on other account number.
 

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