[AccessD] E-Mail Format Template Function

Robert robert at servicexp.com
Tue Apr 13 10:29:36 CDT 2010


Stuart,
 It is indeed all that I need to do.. For some reason I was thinking that it
would be much more complicated... :)

Thanks for the example


WBR
Robert


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Monday, April 12, 2010 8:20 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] E-Mail Format Template Function

This;
   Open "template.txt" for binary as #1
   strText = space$(Lof(1))
   Get #1, strText
  Close #1

will grab the whole template into strText.

This;
   strMessage = Replace(strText,"[CompanyName]",rs!CompanyName)
   strMessage = Replace(strMessage,"[CompanyAddress]",rs!CompanyAddress)
   strMessage = Replace(strMessage,"[CompanyPhone]",rs!CompanyPhone)
   ....
   strMessage = Replace(strMessage,"[RepNam]",rs!ReName)

will replace all of the required placeholders throughout the whole template
even if the appear 
multiple times

Isn't that all that you need to do?

-- 
Stuart

On 12 Apr 2010 at 7:22, Robert wrote:

> Hello Stuart,
>   Kinda,
>   I have all the framework for the e-mail portion.  The function needs to
> copy in the entire template and then scan the line for the placeholders.
> There could be multiple of the same placeholders (Customer formatting
> choice).
> 
> 
> EXAMPLE: (All lines would be copied in)
> 
> Example Start
> 
> ******************START PO ORDER *******************
> 
> Order Being Placed By:
> 
> 	 [CompanyName]	
> 	 [CompanyAddress]
> 	 [CompanyPhone]
> 	 [CompanyAccount]
> 
> Order Being Place with:
> 	 [VendorName]
> 	 [VendorAddress]
> 	 [VendorPhone]
> 	 [RepName]	
> 
> This order's PO NUMBER:  
> 
> 
> Qty		ID-Number		Description
> Cost?			In-Stock?
> 
> 
> 
> 
> 
> 
> Order Shipping Costs:?
> 
> Please return e-mail receipt with associated Cost and In-Stock status.
> 
> 
> 
> ******************END PO ORDER *******************
> 
> 
> Example End
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
McLachlan
> Sent: Saturday, April 10, 2010 7:26 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] E-Mail Format Template Function
> 
> Do you mean something like this (aircode - will need debugging!):  ?
> 
> Dim rs as DAO.Recordset
> Dim strText as String
> Dim strMessage as String
> 
> 'Get Template
> Open "template.txt" for binary as #1
> strText = space$(Lof(1))
> Get #1, strText
> Close #1
> 
> 'Get VendorDetails and send email
> Set rs = currentdb.openrecordset("qryVendorDetailsForEmail")
> 
> While not rs.eof
>     strMessage = Replace(strText,"[VendorName]",rs!VendorName)
>     strMessage = Replace(strStrMessage,"[VendorAddress]",rs!VendorAddress)
>     Docmd.SendObject,,,rs!VendorEmail,,,"This Months News From
> ACME",strMessage,False
> Wend
> 
> rs.Close
> Set rs = Nothing.
> 
> 
> 
> On 10 Apr 2010 at 12:45, Robert wrote:
> 
> > Goal: Send E-Mail based on a user adjustable field placement .txt
template
> > Example: (variable place holders)
> > 
> > [VendorName]
> > [VendorAddress]
> > 
> > User can move field anywhere in the .txt document and I would place the
> > information in the variables...
> > 
> > What's Needed:  An already made function / class that will consume the
> text
> > document, allowing me to place the correct information in the correct
> place
> > holder.  I don't want to recreate the wheel if it's already "out there"
> and
> > someone is willing to share it with me...
> > 
> > Thanks!
> > 
> > WBR
> > Robert
> > 
> > 
> > -- 
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list