E
Erick C
Absolutely, Customer ID (AcctNum) can be sued to identify the reports.
Erick,
Okay... now the we need to find a way to identify the report for each
Customer... I suggested using the CustomerID is that an option for you?
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" - Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Gina -
Sorry, I had an error in my code. I fixed it and the code now creates
individual pdf files for each customer. The file is named
"Sweeps_Report_For_Email000.pdf" and "Sweeps_Report_For_Email001.pdf"
Good morning Gina!
AcctNum is a text field.Erick,
Is it looking at a text field or a numeric field?
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Gina -
I am not the biggest fan of Lotus Notes myself, this would be so much
easier if I was using Outlook. Regarding your email code question,
yes you are correct. The code as it is written emails only one
address at a time. I had guessed that it would be better and easier
to integrate into another code. I also added a list box to my form
that pulls in the customer ID (AcctNum), customer name, and email
address.
I thought that the same list box could be used to pull an email
address right after it was used to create and name the pdf. So, the
identifying portion of the name of the file would come from the
customer ID column in the list box, then the email address from the
email section of the list box. SO basically right after a pdf is made
it is emailed and then it moves on to the next customer ID in the list
box. Does my weird thought process make any sense at all, or was I
way off?
OK, I have changed the code attached to the button, but I have
received an error saying Compile error: can't find project or
library. The debugger highlights Format at the beginning of "Format
(intCounter,"000")"
Here is what my code looks like, did I add something that I was not
supposed to?
Dim intCounter As Integer
Dim cboCode As ComboBox
Set cboCode = Me![CustomerListBox]
For intCounter = 0 To CustomerListBox.ListCount - 1
DoCmd.OpenReport "Sweeps_Report_For_Email", acViewPreview, ,
"[AcctNum] = '" & cboCode.ItemData(intCounter) & "'"
DoEvents
Call ConvertReportToPDF("Report1", , "C:\Users\Erick\Documents\Test
\Sweeps_Report_For_Email" & Format(intCounter, "000") & ".pdf", False,
False)
DoCmd.Close acReport, "Sweeps_Report_For_Email"
Next
Erick,
First, the report has to drop out to individual files, one way or the
other... So whether you use a combo box or a list box doesn't matter.
But
it must loop thru and attach a number or something on to the end of
each
file so it knows the reports are seperate entities. Might be betterto
pick
to pick the CustomerID as the report name so when eMailing the eMail
knows
which report to grab. (I can modify to include CustomerID.)
'Posted by ADezii 5.23.2009 on bytes.com
'Modified by Gina Whipp 11.4.2009 to OutputTo Multiple Files
'Tested in Access 2003
Dim intCounter As Integer
Dim cboCode As ComboBox
Set cboCode = Me![YourComboBox]
For intCounter = 0 To Combo0.ListCount - 1
DoCmd.OpenReport "Sweeps_Report_For_Email", acViewPreview, ,
"[YourFieldControlSource] = '" & cboCode.ItemData(intCounter) & "'"
DoEvents
Call ConvertReportToPDF("Report1", ,
"DriveLetter\FolderName\Sweeps_Report_For_Email" & Format(intCounter,
"000")
& ".pdf", False, False)
DoCmd.Close acReport, "Sweeps_Report_For_Email"
Next
The code you supplied below appears to go to one eMail address at a
time...
Is this true? I don't have Lotus Notes so no way to test.
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Gina -
The email addresses are not actually part of a combo box on my form, I
just have them all in a Customers_To_Email table. The field is "Email
Address" in the table.
I need to somehow set up a loop with the code so an individual report
is created for each customer in the table. The test PDF that was
created has all customers in it, which would not be too cool at all..
I also have a working code for emailing out of Lotus Notes, though I
do not know how to integrate it into the PDF code, but maybe it can
help.
Dim s As Object
Dim db As Object
Dim doc As Object
Dim rtItem As Object
Dim Server As String, Database As String
Dim strError As String
'startup Lotus notes and get object handle
Set s = CreateObject("Notes.notesSession")
Server = s.GETENVIRONMENTSTRING("MailServer", True)
Database = s.GETENVIRONMENTSTRING("MailFile", True)
Set db = s.GetDatabase(Server, Database)
On Error GoTo ErrorLogon
'see if user is logged on
Set doc = db.CreateDocument
On Error GoTo 0
doc.Form = "Memo"
doc.importance = "1" '(Where 1=Urgent, 2= Normal, 3= FYI)
'Send an e-mail to
doc.sendTO = "email address goes here"
doc.RETURNRECEIPT = "1"
doc.Subject = "Test Email"
Set rtItem = doc.CreateRichTextItem("Body")
Call rtItem.AppendText("Test Email")
Call rtItem.AddNewLine(2)
Call rtItem.AppendText("Dear sir or madam")
Call rtItem.AddNewLine(1)
Call rtItem.AppendText("This is a test email for the Treasury
Department. If you have received this in error, please disregard and
delete. ")
Call rtItem.AddNewLine(2)
Call rtItem.EMBEDOBJECT(1454, "", "G:\treas\Erick\Sweep Test Docs
\rates.xls")
doc.SaveMessageOnSend = True
doc.PostedDate = Now() 'Gets the mail to appear in the sent items
folder
Call doc.Send(False)
Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set rtItem = Nothing
ErrorLogon:
If Err.Number = 7063 Then
MsgBox " You must first logon to Lotus Notes"
Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set rtItem = Nothing
End If
Refresh
MsgBox " Your email has been sent"
Erick,
Okay, one more thing... the combo box that has your eMail addresses
in
it...
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
OK, the button opened up the report in preview view in access and
created a pdf file in my test folder (I modified the path in your
code) named MyTestFile.pdf, and the adobe viewer opened up.
Erick,
Then put this line behind a button
DoCmd.OpenReport "Sweeps_Report_For_Email", acViewPreview
Call ConvertReportToPDF("Sweeps_Report_For_Email", ,
"c:\MyTestFile.pdf",
False)
and let me know what the results are. Once we get this working I
will
incorporate into other peice of code.
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know, information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Hi Gina -
I have the module in my database. I have double checked that my
defauly printer is working, everything is printing out of the
database
OK. Double checked to make sure it was not set up to the Adobe PDF
writer.
My report is "Sweeps_Report_For_Email"
On Feb 2, 1:44 pm, "Gina Whipp" <[email protected]>
wrote:
Erick,
Step 1 copy the module into your database and then type here the
name
of
your report. Also make sure you have a default printer assigned
to
windows.
--
Gina Whipp
2010 Microsoft MVP (Access)
"I feel I have been denied critical, need to know,
information!" -
Tremors
II
http://www.regina-whipp.com/index_files/TipList.htm
Hi Gnia -
I apologize for the
...
read more »- Hide quoted text -
- Show quoted text -