![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a number of forms dealing perhaps with members, boats, cruises, diner evenings etc and want to send personal emails out using these forms as the source of the eamil. There is (will be) a button on these forms to open a form called "SendEmails" and the recordsource of the calling form is passed to a field (SQLIn) on the SendEmail form. I am trying to scan a message (memo field) on SendEmail form to find say "XXX" e.g the message is "My surname is XXX" I then want to substiture the person's name for XXX. The XXX is an unbound field SearchString on the SendEmail form. ReplaceField1 is a ComboBox that lists all the field name that it finds in the forms SQLIn field, even if the source is something like "SELECT Member.* FROM Member" Code is If Not IsNull(ReplaceField1) Then SQLStg SQLStg = Replace(SQLIn, ReplaceField1, ReplaceField1 & " AS RF1 ", , 1) End If Later on I have If Not IsNull(ReplaceField1) Then EmailTextOut = Replace(EMailText, SearchString, !rf1 ) End If Where EMailText is the message and EMailTextOut show "My surname is Smith" All works perfectly providing the the original SQLStg is something like "SELECT MemSurname, MemFirstName, MemEmail, ... From Member" However many of the input queries are more like "SELECT Member.* FROM Member". I want to be able to use this form to send anyone a personalised email, so my question is how can I automatically expand the "*" in the SELECT clause so that it will find MemSurname for example? Thanks Phil |
#3
| |||
| |||
|
|
On Fri, 20 Aug 2010 12:49:18 +0100, "Phil" <phil (AT) stantonfamily (DOT) co.uk wrote: One option would be to open a recordset using that sql statement, and then iterate over its Fields collection. -Tom. Microsoft Access MVP I have a number of forms dealing perhaps with members, boats, cruises, diner evenings etc and want to send personal emails out using these forms as the source of the eamil. There is (will be) a button on these forms to open a form called "SendEmails" and the recordsource of the calling form is passed to a field (SQLIn) on the SendEmail form. I am trying to scan a message (memo field) on SendEmail form to find say "XXX" e.g the message is "My surname is XXX" I then want to substiture the person's name for XXX. The XXX is an unbound field SearchString on the SendEmail form. ReplaceField1 is a ComboBox that lists all the field name that it finds in the forms SQLIn field, even if the source is something like "SELECT Member.* FROM Member" Code is If Not IsNull(ReplaceField1) Then SQLStg SQLStg = Replace(SQLIn, ReplaceField1, ReplaceField1 & " AS RF1 ", , 1) End If Later on I have If Not IsNull(ReplaceField1) Then EmailTextOut = Replace(EMailText, SearchString, !rf1 ) End If Where EMailText is the message and EMailTextOut show "My surname is Smith" All works perfectly providing the the original SQLStg is something like "SELECT MemSurname, MemFirstName, MemEmail, ... From Member" However many of the input queries are more like "SELECT Member.* FROM Member". I want to be able to use this form to send anyone a personalised email, so my question is how can I automatically expand the "*" in the SELECT clause so that it will find MemSurname for example? Thanks Phil |
![]() |
| Thread Tools | |
| Display Modes | |
| |