Programming Command Button & Sending Email - This Complexity Possi

C

Curtis Stevens

I'll try to explain this the best I can. I have a command button (an email
icon) with an on click event that creates an email and attaches a file to it.
This field is obtained this way. There is another pull down I have (called
PDFCreatorApproval), which I select a value from that and then hit another
button. When I hit that button, it opens up a report and prints it into a
PDF file and stores it on a certain folder on my pc with the name of this
pull down field box (PDFCreatorApproval).

So when I hit this email icon command button, it then grabs this newly
created PDF file and attaches it to the email address using the customer's
email address.

My goal is to be able to create another pull down and it would then
determine what text is to be used in the email's body & subject. I don't
know what kind of source this pull down should be, like a table with a memo
field or what? Lets use PDFPrintEmailInfo as the name of this new pulldown.

You can get a visual of what I'm talking about here:
www.gotmerchant.com/pulldown.gif

I have pasted the code below for this email icon command button.

My other question is below the code source:

============CODE ==============
Dim objOApp As Object
Dim objOMessage As Object
Dim txtbody As String

Const olMailItem = 0

Set objOApp = CreateObject("Outlook.Application") 'created the
application here
Set objOMessage = objOApp.CreateItem(olMailItem) ' and last here is
an Mail Item

txtbody = "Dear " & Me.Merchant_Principal1 & "," & vbCrLf & vbCrLf & _
"Congratulations, blah, blah, blah!" & vbCrLf & vbCrLf & _
"Please blah, blah, blah" & vbCrLf & _

With objOMessage
.To = [Forms]![Customer Management Screen]![Current]![Biz Email
Address]
.Subject = "Approval"
.body = txtbody
.attachments.add "C:\Documents and Settings\Curtis
Stevens\Desktop\" & Me.PDFCreatorApproval & ".pdf"
.Display

============CODE ==============

NOW, the report I mention in the visual aid pic above, this is the code I
have for its OnOpen event. I want to know what I need to modify so it will
work on any form, as I have several forms that pull up the same data (same
tables), like one form only shows boarded customers, another form only shows
prospects, etc. But the data is all in the same table, using queries to
filter out the records. Like the code below is setup for the form CURRENT
only, so all this mentioned above wont work for anything I need to send, like
an application to a prospect as I use a prospect form, etc. So that means I
have to have a WHOLE new set of pull downs, etc. Not very well designed....

============CODE ==============
Me.RecordSource = "SELECT * FROM Customers WHERE [Contact ID] = " &
[Forms]![Customer Management Screen]![Current]![Contact ID]
============CODE ==============

Thank you so much!!!!

Curtis
 

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