468,119 Members | 1,873 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

Help Sending Email - Access '97

Greetings! I am using Access '97 to track company orders. It's a pretty
basic setup featuring a main table (tbl_SalesSlip) and a related table
(tbl_ModelsSold). I would like to send an email that contains
information from both tables, but am unsure how to go about it. The
data is normalized. A sample of what I would like to send:

Data from tbl_SalesSlip
SalesSlipID
CustomerName
CustomerEmail
CustomerAddress
SaleDate

Data from tbl_ModelsSold
ModelNumber
SalePrice
SerialNumber

I would like to avoid attaching the information to the email as it's
created problems with customers not being able to open items in the
past. I'd really like to include a list of the model numbers in the
body of the email but am unsure as to how I should proceed.

I've played with sending emails in the past and have met with some
success. The following code is what I use to send a customer's receipt
(the receipt is attached).

-----------------------------------------------------------------------------------

Private Sub SendReceipt_Click()
On Error GoTo Err_SendReceipt_Click

Dim stDocName As String
Dim stCustEmail As Variant
Dim stText As String
Dim stSubject As String
Dim stCustEmail2 As Variant

stSubject = "Receipt from Camden TV and Appliance"
stDocName = "rpt_CustomerReceipt"
stCustEmail = DLookup("[email]", "tbl_Customers", "[CustomerID] = " &
Forms![frm_SalesSlip]!CustomerID)
stCustEmail2 = DLookup("[Email2]", "tbl_Customers", "[CustomerID] = " &
Forms![frm_SalesSlip]!CustomerID)

stText = "Greetings! " & Chr$(13) & Chr$(13) & _
"Thank you for your recent purchase via our online store. For your
convenience we have attached a copy of your receipt to this e-mail.
Included in the receipt is are links to any rebates you may be eligible
for. When applying for your rebates please print out two copies, one
for your records and to send along with the appropriate form. " &
Chr$(13) & Chr$(13) & _
"Please feel free to contact us with any questions or concerns!" &
Chr$(13)

DoCmd.SendObject acReport, stDocName, acFormatRTF, stCustEmail,
stCustEmail2, , stSubject, stText
Exit_SendReceipt_Click:
Exit Sub

Err_SendReceipt_Click:
MsgBox err.Description
Resume Exit_SendReceipt_Click

End Sub
-----------------------------------------------------------------------------------

The part I don't understand is how I would insert the model numbers
into the above code. Should I use some sort of loop to insert the
models, do I need to approach this from a completely different angle,
am I an even bigger idiot than usual? Help :)

Nov 29 '06 #1
1 4366

Mose wrote:
Greetings! I am using Access '97 to track company orders. It's a pretty
basic setup featuring a main table (tbl_SalesSlip) and a related table
(tbl_ModelsSold). I would like to send an email that contains
information from both tables, but am unsure how to go about it. The
data is normalized. A sample of what I would like to send:

Data from tbl_SalesSlip
SalesSlipID
CustomerName
CustomerEmail
CustomerAddress
SaleDate

Data from tbl_ModelsSold
ModelNumber
SalePrice
SerialNumber

I would like to avoid attaching the information to the email as it's
created problems with customers not being able to open items in the
past. I'd really like to include a list of the model numbers in the
body of the email but am unsure as to how I should proceed.

I've played with sending emails in the past and have met with some
success. The following code is what I use to send a customer's receipt
(the receipt is attached).

-----------------------------------------------------------------------------------

Private Sub SendReceipt_Click()
On Error GoTo Err_SendReceipt_Click

Dim stDocName As String
Dim stCustEmail As Variant
Dim stText As String
Dim stSubject As String
Dim stCustEmail2 As Variant

stSubject = "Receipt from Camden TV and Appliance"
stDocName = "rpt_CustomerReceipt"
stCustEmail = DLookup("[email]", "tbl_Customers", "[CustomerID] = " &
Forms![frm_SalesSlip]!CustomerID)
stCustEmail2 = DLookup("[Email2]", "tbl_Customers", "[CustomerID] = " &
Forms![frm_SalesSlip]!CustomerID)

stText = "Greetings! " & Chr$(13) & Chr$(13) & _
"Thank you for your recent purchase via our online store. For your
convenience we have attached a copy of your receipt to this e-mail.
Included in the receipt is are links to any rebates you may be eligible
for. When applying for your rebates please print out two copies, one
for your records and to send along with the appropriate form. " &
Chr$(13) & Chr$(13) & _
"Please feel free to contact us with any questions or concerns!" &
Chr$(13)

DoCmd.SendObject acReport, stDocName, acFormatRTF, stCustEmail,
stCustEmail2, , stSubject, stText
Exit_SendReceipt_Click:
Exit Sub

Err_SendReceipt_Click:
MsgBox err.Description
Resume Exit_SendReceipt_Click

End Sub
-----------------------------------------------------------------------------------

The part I don't understand is how I would insert the model numbers
into the above code. Should I use some sort of loop to insert the
models, do I need to approach this from a completely different angle,
am I an even bigger idiot than usual? Help :)
Create a RecordSet of model Nos an use that in the body of the email

Nov 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by David | last post: by
1 post views Thread by Devonish | last post: by
2 posts views Thread by kimberly.shaffer | last post: by
6 posts views Thread by \jason via DotNetMonster.com\ | last post: by
2 posts views Thread by ornto | last post: by
18 posts views Thread by CenturionX | last post: by
13 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.