CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 email a subset of members in my database after a record is inserted into the database

Print topic Send  topic

Author Message
GRQNET
Posted: 06/29/2003, 12:59 PM

I would like to be able to email a subset of members in my database after a
record is inserted into the database.
I want the subset of members filtered by a field in the database record that
was submitted.

The database form that gets filled out looks something like this:

Name:
Address:
City:
State:
Zip:
Catagory:

The catagory's can vary, such as: music, art, math, etc...

In the member table I have a field called "desired_catagory" which the
member entered their catagory preference such as "music" for example.

If a user fills out the database form and enters a catagory of "music", I
would like
this information emailed to ALL the matching members in the members table
that have
selected "music" in their desired_catagory.

I am using CodeCharge Studio with ASP coding.
I am linking to my database called Membership.mdb
The table that contains the member information is called members.

Any help is appreciated.

Thanks.

Anthony :)

DonB
Posted: 06/30/2003, 1:27 PM

I assume that there is a "email" column in the Membership table with their
email address in it?

If your database supports stored procedures (is it SQL Server?). Then I'd
write a stored procedure to send them from there. If stored procedures are
"out", then you'll have to write code in the AfterExecute Insert and
AfterExecuteUpdate events to send the email. Dim a recordset and use it to
retrieve the email addresses:

(my example variable and object names are made up, so interprete
accordingly)

Dim rs

If DBconnection1.state <> 1 Then DBconnection1.Open
Set rs = DBconnection1.Execute("SELECT emailaddress FROM Membership WHERE
catagory = '" & desired_catagory.value & "'")

While not rs.EOF
Call emailprogram (strMessage, strSubject, strFrom,
rs.Fields("emailaddress")
Wend

set rs = Nothing

The "emailprogram" part is where things get dicey. I happen to prefer
Persits' ASPEmail object (http://www.persits.com). You may not have it,
but instead have something else available. You may find you can't use ANY
3rd party stuff due to your host's restrictions.

That said, the Persits object is really easy to install and use and is
extremely well-documented on their site. They offer a "basic" version for
free as well as a reasonably-priced full-up version. You don't need
anything but the basic version to do what you are asking to do.

--
DonB

http://www.gotodon.com/ccbth



"GRQNET" <Webmaster@grq.net> wrote in message
news:bdngf5$jng$1@news.codecharge.com...
> I would like to be able to email a subset of members in my database after
a
> record is inserted into the database.
> I want the subset of members filtered by a field in the database record
that
> was submitted.
>
> The database form that gets filled out looks something like this:
>
> Name:
> Address:
> City:
> State:
> Zip:
> Catagory:
>
> The catagory's can vary, such as: music, art, math, etc...
>
> In the member table I have a field called "desired_catagory" which the
> member entered their catagory preference such as "music" for example.
>
> If a user fills out the database form and enters a catagory of "music", I
> would like
> this information emailed to ALL the matching members in the members table
> that have
> selected "music" in their desired_catagory.
>
> I am using CodeCharge Studio with ASP coding.
> I am linking to my database called Membership.mdb
> The table that contains the member information is called members.
>
> Any help is appreciated.
>
> Thanks.
>
> Anthony :)
>
>

GRQNET
Posted: 06/30/2003, 6:49 PM

Hi Don,

Thanks for the info. I am a VERY newbee and I am still having problems with
getting this to work.
I am using a Microsoft Access database. The connection I have is called
DBWTTMembership, so I just substituted the DBconnection1 with that.
The table of all the the members is called "members". The email field is
called "email".
The desired catagory field (called "desired_catagory") is a field that will
gets inserted into the "postings" table of the same database.
I want this function to run when a posting is inserted into the postings
table - so I intend on placing the code at the "after insert" section.

I already have CDONTS email working. I tested it using a single test send
and it worked.

This is what I have so far:

Function ==================
Dim rs

If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE catagory
= '" & desired_catagory.value & "'")

While not rs.EOF

'Send Email @12-24842035

With CreateObject("CDONTS.NewMail")
.From =Me@MyDomain.com
.To = rs.Fields("email")
.Subject = "A match has been found""
.Body = "The body will contain text and fields from the table
postings"
.BodyFormat = 1
.MailFormat = 0
.Send
End With

'End Send Email

Wend

set rs = Nothing

End Function ==================

Can you tell me where I went wrong.
Thanks.
Anthony.







"DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
news:bdq6gb$3ou$1@news.codecharge.com...
> I assume that there is a "email" column in the Membership table with their
> email address in it?
>
> If your database supports stored procedures (is it SQL Server?). Then I'd
> write a stored procedure to send them from there. If stored procedures
are
> "out", then you'll have to write code in the AfterExecute Insert and
> AfterExecuteUpdate events to send the email. Dim a recordset and use it
to
> retrieve the email addresses:
>
> (my example variable and object names are made up, so interprete
> accordingly)
>
> Dim rs
>
> If DBconnection1.state <> 1 Then DBconnection1.Open
> Set rs = DBconnection1.Execute("SELECT emailaddress FROM Membership WHERE
> catagory = '" & desired_catagory.value & "'")
>
> While not rs.EOF
> Call emailprogram (strMessage, strSubject, strFrom,
> rs.Fields("emailaddress")
> Wend
>
> set rs = Nothing
>
> The "emailprogram" part is where things get dicey. I happen to prefer
> Persits' ASPEmail object (http://www.persits.com). You may not have it,
> but instead have something else available. You may find you can't use ANY
> 3rd party stuff due to your host's restrictions.
>
> That said, the Persits object is really easy to install and use and is
> extremely well-documented on their site. They offer a "basic" version for
> free as well as a reasonably-priced full-up version. You don't need
> anything but the basic version to do what you are asking to do.
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
>
> "GRQNET" <Webmaster@grq.net> wrote in message
>news:bdngf5$jng$1@news.codecharge.com...
> > I would like to be able to email a subset of members in my database
after
> a
> > record is inserted into the database.
> > I want the subset of members filtered by a field in the database record
> that
> > was submitted.
> >
> > The database form that gets filled out looks something like this:
> >
> > Name:
> > Address:
> > City:
> > State:
> > Zip:
> > Catagory:
> >
> > The catagory's can vary, such as: music, art, math, etc...
> >
> > In the member table I have a field called "desired_catagory" which the
> > member entered their catagory preference such as "music" for example.
> >
> > If a user fills out the database form and enters a catagory of "music",
I
> > would like
> > this information emailed to ALL the matching members in the members
table
> > that have
> > selected "music" in their desired_catagory.
> >
> > I am using CodeCharge Studio with ASP coding.
> > I am linking to my database called Membership.mdb
> > The table that contains the member information is called members.
> >
> > Any help is appreciated.
> >
> > Thanks.
> >
> > Anthony :)
> >
> >
>
>

DonB
Posted: 06/30/2003, 8:56 PM

you are missing one important thing that I can see - the rs.movenext - to
step through the records. I assume your while loop never terminates?

Donb

.

Paste the code in there and you should be all set.
"GRQNET" <Webmaster@grq.net> wrote in message
news:bdqpbm$se2$1@news.codecharge.com...
> Hi Don,
>
> Thanks for the info. I am a VERY newbee and I am still having problems
with
> getting this to work.
> I am using a Microsoft Access database. The connection I have is called
> DBWTTMembership, so I just substituted the DBconnection1 with that.
> The table of all the the members is called "members". The email field is
> called "email".
> The desired catagory field (called "desired_catagory") is a field that
will
> gets inserted into the "postings" table of the same database.
> I want this function to run when a posting is inserted into the postings
> table - so I intend on placing the code at the "after insert" section.
>
> I already have CDONTS email working. I tested it using a single test send
> and it worked.
>
> This is what I have so far:
>
> Function ==================
> Dim rs
>
> If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
catagory
> = '" & desired_catagory.value & "'")
>
> While not rs.EOF
>
> 'Send Email @12-24842035
>
> With CreateObject("CDONTS.NewMail")
> .From =Me@MyDomain.com
> .To = rs.Fields("email")
> .Subject = "A match has been found""
> .Body = "The body will contain text and fields from the table
> postings"
> .BodyFormat = 1
> .MailFormat = 0
> .Send
> End With
>
> 'End Send Email
>
> Wend
>
> set rs = Nothing
>
> End Function ==================
>
> Can you tell me where I went wrong.
> Thanks.
> Anthony.
>
>
>
>
>
>
>
> "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
>news:bdq6gb$3ou$1@news.codecharge.com...
> > I assume that there is a "email" column in the Membership table with
their
> > email address in it?
> >
> > If your database supports stored procedures (is it SQL Server?). Then
I'd
> > write a stored procedure to send them from there. If stored procedures
> are
> > "out", then you'll have to write code in the AfterExecute Insert and
> > AfterExecuteUpdate events to send the email. Dim a recordset and use it
> to
> > retrieve the email addresses:
> >
> > (my example variable and object names are made up, so interprete
> > accordingly)
> >
> > Dim rs
> >
> > If DBconnection1.state <> 1 Then DBconnection1.Open
> > Set rs = DBconnection1.Execute("SELECT emailaddress FROM Membership
WHERE
> > catagory = '" & desired_catagory.value & "'")
> >
> > While not rs.EOF
> > Call emailprogram (strMessage, strSubject, strFrom,
> > rs.Fields("emailaddress")
> > Wend
> >
> > set rs = Nothing
> >
> > The "emailprogram" part is where things get dicey. I happen to prefer
> > Persits' ASPEmail object (http://www.persits.com). You may not have
it,
> > but instead have something else available. You may find you can't use
ANY
> > 3rd party stuff due to your host's restrictions.
> >
> > That said, the Persits object is really easy to install and use and is
> > extremely well-documented on their site. They offer a "basic" version
for
> > free as well as a reasonably-priced full-up version. You don't need
> > anything but the basic version to do what you are asking to do.
> >
> > --
> > DonB
> >
> > http://www.gotodon.com/ccbth
> >
> >
> >
> > "GRQNET" <Webmaster@grq.net> wrote in message
> >news:bdngf5$jng$1@news.codecharge.com...
> > > I would like to be able to email a subset of members in my database
> after
> > a
> > > record is inserted into the database.
> > > I want the subset of members filtered by a field in the database
record
> > that
> > > was submitted.
> > >
> > > The database form that gets filled out looks something like this:
> > >
> > > Name:
> > > Address:
> > > City:
> > > State:
> > > Zip:
> > > Catagory:
> > >
> > > The catagory's can vary, such as: music, art, math, etc...
> > >
> > > In the member table I have a field called "desired_catagory" which the
> > > member entered their catagory preference such as "music" for example.
> > >
> > > If a user fills out the database form and enters a catagory of
"music",
> I
> > > would like
> > > this information emailed to ALL the matching members in the members
> table
> > > that have
> > > selected "music" in their desired_catagory.
> > >
> > > I am using CodeCharge Studio with ASP coding.
> > > I am linking to my database called Membership.mdb
> > > The table that contains the member information is called members.
> > >
> > > Any help is appreciated.
> > >
> > > Thanks.
> > >
> > > Anthony :)
> > >
> > >
> >
> >
>
>

GRQNET
Posted: 07/01/2003, 3:06 PM


That did it!
Thank you!
Anthony.


"DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
news:bdr0p5$63a$1@news.codecharge.com...
> you are missing one important thing that I can see - the rs.movenext - to
> step through the records. I assume your while loop never terminates?
>
> Donb
>
> .
>
> Paste the code in there and you should be all set.
> "GRQNET" <Webmaster@grq.net> wrote in message
>news:bdqpbm$se2$1@news.codecharge.com...
> > Hi Don,
> >
> > Thanks for the info. I am a VERY newbee and I am still having problems
> with
> > getting this to work.
> > I am using a Microsoft Access database. The connection I have is called
> > DBWTTMembership, so I just substituted the DBconnection1 with that.
> > The table of all the the members is called "members". The email field is
> > called "email".
> > The desired catagory field (called "desired_catagory") is a field that
> will
> > gets inserted into the "postings" table of the same database.
> > I want this function to run when a posting is inserted into the postings
> > table - so I intend on placing the code at the "after insert" section.
> >
> > I already have CDONTS email working. I tested it using a single test
send
> > and it worked.
> >
> > This is what I have so far:
> >
> > Function ==================
> > Dim rs
> >
> > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
> catagory
> > = '" & desired_catagory.value & "'")
> >
> > While not rs.EOF
> >
> > 'Send Email @12-24842035
> >
> > With CreateObject("CDONTS.NewMail")
> > .From =Me@MyDomain.com
> > .To = rs.Fields("email")
> > .Subject = "A match has been found""
> > .Body = "The body will contain text and fields from the table
> > postings"
> > .BodyFormat = 1
> > .MailFormat = 0
> > .Send
> > End With
> >
> > 'End Send Email
> >
> > Wend
> >
> > set rs = Nothing
> >
> > End Function ==================
> >
> > Can you tell me where I went wrong.
> > Thanks.
> > Anthony.
> >
> >
> >
> >
> >
> >
> >
> > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> >news:bdq6gb$3ou$1@news.codecharge.com...
> > > I assume that there is a "email" column in the Membership table with
> their
> > > email address in it?
> > >
> > > If your database supports stored procedures (is it SQL Server?). Then
> I'd
> > > write a stored procedure to send them from there. If stored
procedures
> > are
> > > "out", then you'll have to write code in the AfterExecute Insert and
> > > AfterExecuteUpdate events to send the email. Dim a recordset and use
it
> > to
> > > retrieve the email addresses:
> > >
> > > (my example variable and object names are made up, so interprete
> > > accordingly)
> > >
> > > Dim rs
> > >
> > > If DBconnection1.state <> 1 Then DBconnection1.Open
> > > Set rs = DBconnection1.Execute("SELECT emailaddress FROM Membership
> WHERE
> > > catagory = '" & desired_catagory.value & "'")
> > >
> > > While not rs.EOF
> > > Call emailprogram (strMessage, strSubject, strFrom,
> > > rs.Fields("emailaddress")
> > > Wend
> > >
> > > set rs = Nothing
> > >
> > > The "emailprogram" part is where things get dicey. I happen to prefer
> > > Persits' ASPEmail object (http://www.persits.com). You may not have
> it,
> > > but instead have something else available. You may find you can't use
> ANY
> > > 3rd party stuff due to your host's restrictions.
> > >
> > > That said, the Persits object is really easy to install and use and is
> > > extremely well-documented on their site. They offer a "basic" version
> for
> > > free as well as a reasonably-priced full-up version. You don't need
> > > anything but the basic version to do what you are asking to do.
> > >
> > > --
> > > DonB
> > >
> > > http://www.gotodon.com/ccbth
> > >
> > >
> > >
> > > "GRQNET" <Webmaster@grq.net> wrote in message
> > >news:bdngf5$jng$1@news.codecharge.com...
> > > > I would like to be able to email a subset of members in my database
> > after
> > > a
> > > > record is inserted into the database.
> > > > I want the subset of members filtered by a field in the database
> record
> > > that
> > > > was submitted.
> > > >
> > > > The database form that gets filled out looks something like this:
> > > >
> > > > Name:
> > > > Address:
> > > > City:
> > > > State:
> > > > Zip:
> > > > Catagory:
> > > >
> > > > The catagory's can vary, such as: music, art, math, etc...
> > > >
> > > > In the member table I have a field called "desired_catagory" which
the
> > > > member entered their catagory preference such as "music" for
example.
> > > >
> > > > If a user fills out the database form and enters a catagory of
> "music",
> > I
> > > > would like
> > > > this information emailed to ALL the matching members in the members
> > table
> > > > that have
> > > > selected "music" in their desired_catagory.
> > > >
> > > > I am using CodeCharge Studio with ASP coding.
> > > > I am linking to my database called Membership.mdb
> > > > The table that contains the member information is called members.
> > > >
> > > > Any help is appreciated.
> > > >
> > > > Thanks.
> > > >
> > > > Anthony :)
> > > >
> > > >
> > >
> > >
> >
> >
>
>

GRQNET
Posted: 07/01/2003, 8:25 PM

One more problem.
I thought I had this working. But for some reason it doesn't work
consistently.
I started to get a server error "Too Many Client Tasks" and nothing ran.
I realized that I needed to close the database so, I added the
DBWTTMembership.Close line at the end.
My provider reset the server for me and now for some reason, the script no
longer works.
My provider said that the problem must be with the code since they tested
the CDONTS works.
I tested a single email form using Cdonts and it worked.
Any help is appreciated. I wish I knew coding better.. I am learning but
it's slow.
If you can also let me know any good sources for learing this code, that too
would be appreciated.
Thanks.
Anthony.


Here is the final code I am using that is not working:

The WTTMailingList is a checkbox that the member checks if they want the
mailings.
The MemberEmails.SentTo.text is a group number from 1 to 5. Choosing 1
sends emails to all the basic members, etc...


Function MemberEmails_AfterInsert() 'MemberEmails_AfterInsert @2-800E96EB

Dim rs

If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
Set rs = DBWTTMembership.Execute ("SELECT email FROM members Where
MembershipLevel_ID = " & MemberEmails.SentTo.Text & " AND WTTMailingList =
True")

While not rs.EOF

'Send Email @13-6962F8CA
With CreateObject("CDONTS.NewMail")
.From = "Info@mydomain.com"
.To = rs.Fields("email")
.Subject = MemberEmails.Subject.Text
.Body = MemberEmails.Message.Text
.BodyFormat = 1
.MailFormat = 0
.Send
End With
'End Send Email

rs.MoveNext

Wend
set rs = Nothing
DBWTTMembership.Close

End Function 'Close MemberEmails_AfterInsert @2-54C34B28







"GRQNET" <Webmaster@grq.net> wrote in message
news:bdt0l3$uh8$1@news.codecharge.com...
>
> That did it!
> Thank you!
> Anthony.
>
>
> "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
>news:bdr0p5$63a$1@news.codecharge.com...
> > you are missing one important thing that I can see - the rs.movenext -
to
> > step through the records. I assume your while loop never terminates?
> >
> > Donb
> >
> > .
> >
> > Paste the code in there and you should be all set.
> > "GRQNET" <Webmaster@grq.net> wrote in message
> >news:bdqpbm$se2$1@news.codecharge.com...
> > > Hi Don,
> > >
> > > Thanks for the info. I am a VERY newbee and I am still having problems
> > with
> > > getting this to work.
> > > I am using a Microsoft Access database. The connection I have is
called
> > > DBWTTMembership, so I just substituted the DBconnection1 with that.
> > > The table of all the the members is called "members". The email field
is
> > > called "email".
> > > The desired catagory field (called "desired_catagory") is a field that
> > will
> > > gets inserted into the "postings" table of the same database.
> > > I want this function to run when a posting is inserted into the
postings
> > > table - so I intend on placing the code at the "after insert" section.
> > >
> > > I already have CDONTS email working. I tested it using a single test
> send
> > > and it worked.
> > >
> > > This is what I have so far:
> > >
> > > Function ==================
> > > Dim rs
> > >
> > > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > > Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
> > catagory
> > > = '" & desired_catagory.value & "'")
> > >
> > > While not rs.EOF
> > >
> > > 'Send Email @12-24842035
> > >
> > > With CreateObject("CDONTS.NewMail")
> > > .From =Me@MyDomain.com
> > > .To = rs.Fields("email")
> > > .Subject = "A match has been found""
> > > .Body = "The body will contain text and fields from the table
> > > postings"
> > > .BodyFormat = 1
> > > .MailFormat = 0
> > > .Send
> > > End With
> > >
> > > 'End Send Email
> > >
> > > Wend
> > >
> > > set rs = Nothing
> > >
> > > End Function ==================
> > >
> > > Can you tell me where I went wrong.
> > > Thanks.
> > > Anthony.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > >news:bdq6gb$3ou$1@news.codecharge.com...
> > > > I assume that there is a "email" column in the Membership table with
> > their
> > > > email address in it?
> > > >
> > > > If your database supports stored procedures (is it SQL Server?).
Then
> > I'd
> > > > write a stored procedure to send them from there. If stored
> procedures
> > > are
> > > > "out", then you'll have to write code in the AfterExecute Insert and
> > > > AfterExecuteUpdate events to send the email. Dim a recordset and
use
> it
> > > to
> > > > retrieve the email addresses:
> > > >
> > > > (my example variable and object names are made up, so interprete
> > > > accordingly)
> > > >
> > > > Dim rs
> > > >
> > > > If DBconnection1.state <> 1 Then DBconnection1.Open
> > > > Set rs = DBconnection1.Execute("SELECT emailaddress FROM Membership
> > WHERE
> > > > catagory = '" & desired_catagory.value & "'")
> > > >
> > > > While not rs.EOF
> > > > Call emailprogram (strMessage, strSubject, strFrom,
> > > > rs.Fields("emailaddress")
> > > > Wend
> > > >
> > > > set rs = Nothing
> > > >
> > > > The "emailprogram" part is where things get dicey. I happen to
prefer
> > > > Persits' ASPEmail object (http://www.persits.com). You may not
have
> > it,
> > > > but instead have something else available. You may find you can't
use
> > ANY
> > > > 3rd party stuff due to your host's restrictions.
> > > >
> > > > That said, the Persits object is really easy to install and use and
is
> > > > extremely well-documented on their site. They offer a "basic"
version
> > for
> > > > free as well as a reasonably-priced full-up version. You don't need
> > > > anything but the basic version to do what you are asking to do.
> > > >
> > > > --
> > > > DonB
> > > >
> > > > http://www.gotodon.com/ccbth
> > > >
> > > >
> > > >
> > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > >news:bdngf5$jng$1@news.codecharge.com...
> > > > > I would like to be able to email a subset of members in my
database
> > > after
> > > > a
> > > > > record is inserted into the database.
> > > > > I want the subset of members filtered by a field in the database
> > record
> > > > that
> > > > > was submitted.
> > > > >
> > > > > The database form that gets filled out looks something like this:
> > > > >
> > > > > Name:
> > > > > Address:
> > > > > City:
> > > > > State:
> > > > > Zip:
> > > > > Catagory:
> > > > >
> > > > > The catagory's can vary, such as: music, art, math, etc...
> > > > >
> > > > > In the member table I have a field called "desired_catagory" which
> the
> > > > > member entered their catagory preference such as "music" for
> example.
> > > > >
> > > > > If a user fills out the database form and enters a catagory of
> > "music",
> > > I
> > > > > would like
> > > > > this information emailed to ALL the matching members in the
members
> > > table
> > > > > that have
> > > > > selected "music" in their desired_catagory.
> > > > >
> > > > > I am using CodeCharge Studio with ASP coding.
> > > > > I am linking to my database called Membership.mdb
> > > > > The table that contains the member information is called members.
> > > > >
> > > > > Any help is appreciated.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Anthony :)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

DonB
Posted: 07/02/2003, 6:00 AM

Hmmm, you can try explicitly closing the recordset: rs.Close

Do this right before you set it to Nothing.

It is interesting how you used the "With". I've never seen that done
before. Maybe you would be better off Set-ting a variable that you can then
set to Nothing afterwards.

It's always a good idea to do this to objects to be sure they terminate.

Donb



"GRQNET" <Webmaster@grq.net> wrote in message
news:bdtjar$l6s$1@news.codecharge.com...
> One more problem.
> I thought I had this working. But for some reason it doesn't work
> consistently.
> I started to get a server error "Too Many Client Tasks" and nothing ran.
> I realized that I needed to close the database so, I added the
> DBWTTMembership.Close line at the end.
> My provider reset the server for me and now for some reason, the script no
> longer works.
> My provider said that the problem must be with the code since they tested
> the CDONTS works.
> I tested a single email form using Cdonts and it worked.
> Any help is appreciated. I wish I knew coding better.. I am learning but
> it's slow.
> If you can also let me know any good sources for learing this code, that
too
> would be appreciated.
> Thanks.
> Anthony.
>
>
> Here is the final code I am using that is not working:
>
> The WTTMailingList is a checkbox that the member checks if they want the
> mailings.
> The MemberEmails.SentTo.text is a group number from 1 to 5. Choosing 1
> sends emails to all the basic members, etc...
>
>
> Function MemberEmails_AfterInsert() 'MemberEmails_AfterInsert @2-800E96EB
>
> Dim rs
>
> If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> Set rs = DBWTTMembership.Execute ("SELECT email FROM members Where
> MembershipLevel_ID = " & MemberEmails.SentTo.Text & " AND WTTMailingList =
> True")
>
> While not rs.EOF
>
> 'Send Email @13-6962F8CA
> With CreateObject("CDONTS.NewMail")
> .From = "Info@mydomain.com"
> .To = rs.Fields("email")
> .Subject = MemberEmails.Subject.Text
> .Body = MemberEmails.Message.Text
> .BodyFormat = 1
> .MailFormat = 0
> .Send
> End With
> 'End Send Email
>
> rs.MoveNext
>
> Wend
> set rs = Nothing
> DBWTTMembership.Close
>
> End Function 'Close MemberEmails_AfterInsert @2-54C34B28
>
>
>
>
>
>
>
> "GRQNET" <Webmaster@grq.net> wrote in message
>news:bdt0l3$uh8$1@news.codecharge.com...
> >
> > That did it!
> > Thank you!
> > Anthony.
> >
> >
> > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> >news:bdr0p5$63a$1@news.codecharge.com...
> > > you are missing one important thing that I can see - the rs.movenext -
> to
> > > step through the records. I assume your while loop never terminates?
> > >
> > > Donb
> > >
> > > .
> > >
> > > Paste the code in there and you should be all set.
> > > "GRQNET" <Webmaster@grq.net> wrote in message
> > >news:bdqpbm$se2$1@news.codecharge.com...
> > > > Hi Don,
> > > >
> > > > Thanks for the info. I am a VERY newbee and I am still having
problems
> > > with
> > > > getting this to work.
> > > > I am using a Microsoft Access database. The connection I have is
> called
> > > > DBWTTMembership, so I just substituted the DBconnection1 with that.
> > > > The table of all the the members is called "members". The email
field
> is
> > > > called "email".
> > > > The desired catagory field (called "desired_catagory") is a field
that
> > > will
> > > > gets inserted into the "postings" table of the same database.
> > > > I want this function to run when a posting is inserted into the
> postings
> > > > table - so I intend on placing the code at the "after insert"
section.
> > > >
> > > > I already have CDONTS email working. I tested it using a single test
> > send
> > > > and it worked.
> > > >
> > > > This is what I have so far:
> > > >
> > > > Function ==================
> > > > Dim rs
> > > >
> > > > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > > > Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
> > > catagory
> > > > = '" & desired_catagory.value & "'")
> > > >
> > > > While not rs.EOF
> > > >
> > > > 'Send Email @12-24842035
> > > >
> > > > With CreateObject("CDONTS.NewMail")
> > > > .From =Me@MyDomain.com
> > > > .To = rs.Fields("email")
> > > > .Subject = "A match has been found""
> > > > .Body = "The body will contain text and fields from the
table
> > > > postings"
> > > > .BodyFormat = 1
> > > > .MailFormat = 0
> > > > .Send
> > > > End With
> > > >
> > > > 'End Send Email
> > > >
> > > > Wend
> > > >
> > > > set rs = Nothing
> > > >
> > > > End Function ==================
> > > >
> > > > Can you tell me where I went wrong.
> > > > Thanks.
> > > > Anthony.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > > >news:bdq6gb$3ou$1@news.codecharge.com...
> > > > > I assume that there is a "email" column in the Membership table
with
> > > their
> > > > > email address in it?
> > > > >
> > > > > If your database supports stored procedures (is it SQL Server?).
> Then
> > > I'd
> > > > > write a stored procedure to send them from there. If stored
> > procedures
> > > > are
> > > > > "out", then you'll have to write code in the AfterExecute Insert
and
> > > > > AfterExecuteUpdate events to send the email. Dim a recordset and
> use
> > it
> > > > to
> > > > > retrieve the email addresses:
> > > > >
> > > > > (my example variable and object names are made up, so interprete
> > > > > accordingly)
> > > > >
> > > > > Dim rs
> > > > >
> > > > > If DBconnection1.state <> 1 Then DBconnection1.Open
> > > > > Set rs = DBconnection1.Execute("SELECT emailaddress FROM
Membership
> > > WHERE
> > > > > catagory = '" & desired_catagory.value & "'")
> > > > >
> > > > > While not rs.EOF
> > > > > Call emailprogram (strMessage, strSubject, strFrom,
> > > > > rs.Fields("emailaddress")
> > > > > Wend
> > > > >
> > > > > set rs = Nothing
> > > > >
> > > > > The "emailprogram" part is where things get dicey. I happen to
> prefer
> > > > > Persits' ASPEmail object (http://www.persits.com). You may not
> have
> > > it,
> > > > > but instead have something else available. You may find you can't
> use
> > > ANY
> > > > > 3rd party stuff due to your host's restrictions.
> > > > >
> > > > > That said, the Persits object is really easy to install and use
and
> is
> > > > > extremely well-documented on their site. They offer a "basic"
> version
> > > for
> > > > > free as well as a reasonably-priced full-up version. You don't
need
> > > > > anything but the basic version to do what you are asking to do.
> > > > >
> > > > > --
> > > > > DonB
> > > > >
> > > > > http://www.gotodon.com/ccbth
> > > > >
> > > > >
> > > > >
> > > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > > >news:bdngf5$jng$1@news.codecharge.com...
> > > > > > I would like to be able to email a subset of members in my
> database
> > > > after
> > > > > a
> > > > > > record is inserted into the database.
> > > > > > I want the subset of members filtered by a field in the database
> > > record
> > > > > that
> > > > > > was submitted.
> > > > > >
> > > > > > The database form that gets filled out looks something like
this:
> > > > > >
> > > > > > Name:
> > > > > > Address:
> > > > > > City:
> > > > > > State:
> > > > > > Zip:
> > > > > > Catagory:
> > > > > >
> > > > > > The catagory's can vary, such as: music, art, math, etc...
> > > > > >
> > > > > > In the member table I have a field called "desired_catagory"
which
> > the
> > > > > > member entered their catagory preference such as "music" for
> > example.
> > > > > >
> > > > > > If a user fills out the database form and enters a catagory of
> > > "music",
> > > > I
> > > > > > would like
> > > > > > this information emailed to ALL the matching members in the
> members
> > > > table
> > > > > > that have
> > > > > > selected "music" in their desired_catagory.
> > > > > >
> > > > > > I am using CodeCharge Studio with ASP coding.
> > > > > > I am linking to my database called Membership.mdb
> > > > > > The table that contains the member information is called
members.
> > > > > >
> > > > > > Any help is appreciated.
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > Anthony :)
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

GRQNET
Posted: 07/03/2003, 9:07 PM

I think that got it working.
I am now able to send out bulk emails to the membership database as well.
One problem I am running into now is a script time-out error.
My provider is Dell and I don't think they are going to allow me to change
the time-out's for the script processing.
But when I send out a bulk mail to my basic membership (3000 members), the
script times out.

I get the following error:

Active Server Pages error 'ASP 0113'
Script timed out
/WttDatabase/email/MemberEmailRecord.asp
The maximum amount of time for a script to execute was exceeded. You can
change this limit by specifying a new value for the property
Server.ScriptTimeout or by changing the value in the IIS administration
tools.

What do you think I should do to get around this error?
Thanks again!!

Anthony.





"DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
news:bdul1a$utg$1@news.codecharge.com...
> Hmmm, you can try explicitly closing the recordset: rs.Close
>
> Do this right before you set it to Nothing.
>
> It is interesting how you used the "With". I've never seen that done
> before. Maybe you would be better off Set-ting a variable that you can
then
> set to Nothing afterwards.
>
> It's always a good idea to do this to objects to be sure they terminate.
>
> Donb
>
>
>
> "GRQNET" <Webmaster@grq.net> wrote in message
>news:bdtjar$l6s$1@news.codecharge.com...
> > One more problem.
> > I thought I had this working. But for some reason it doesn't work
> > consistently.
> > I started to get a server error "Too Many Client Tasks" and nothing
ran.
> > I realized that I needed to close the database so, I added the
> > DBWTTMembership.Close line at the end.
> > My provider reset the server for me and now for some reason, the script
no
> > longer works.
> > My provider said that the problem must be with the code since they
tested
> > the CDONTS works.
> > I tested a single email form using Cdonts and it worked.
> > Any help is appreciated. I wish I knew coding better.. I am learning
but
> > it's slow.
> > If you can also let me know any good sources for learing this code, that
> too
> > would be appreciated.
> > Thanks.
> > Anthony.
> >
> >
> > Here is the final code I am using that is not working:
> >
> > The WTTMailingList is a checkbox that the member checks if they want the
> > mailings.
> > The MemberEmails.SentTo.text is a group number from 1 to 5. Choosing 1
> > sends emails to all the basic members, etc...
> >
> >
> > Function MemberEmails_AfterInsert() 'MemberEmails_AfterInsert
@2-800E96EB
> >
> > Dim rs
> >
> > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > Set rs = DBWTTMembership.Execute ("SELECT email FROM members Where
> > MembershipLevel_ID = " & MemberEmails.SentTo.Text & " AND WTTMailingList
=
> > True")
> >
> > While not rs.EOF
> >
> > 'Send Email @13-6962F8CA
> > With CreateObject("CDONTS.NewMail")
> > .From = "Info@mydomain.com"
> > .To = rs.Fields("email")
> > .Subject = MemberEmails.Subject.Text
> > .Body = MemberEmails.Message.Text
> > .BodyFormat = 1
> > .MailFormat = 0
> > .Send
> > End With
> > 'End Send Email
> >
> > rs.MoveNext
> >
> > Wend
> > set rs = Nothing
> > DBWTTMembership.Close
> >
> > End Function 'Close MemberEmails_AfterInsert @2-54C34B28
> >
> >
> >
> >
> >
> >
> >
> > "GRQNET" <Webmaster@grq.net> wrote in message
> >news:bdt0l3$uh8$1@news.codecharge.com...
> > >
> > > That did it!
> > > Thank you!
> > > Anthony.
> > >
> > >
> > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > >news:bdr0p5$63a$1@news.codecharge.com...
> > > > you are missing one important thing that I can see - the
rs.movenext -
> > to
> > > > step through the records. I assume your while loop never
terminates?
> > > >
> > > > Donb
> > > >
> > > > .
> > > >
> > > > Paste the code in there and you should be all set.
> > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > >news:bdqpbm$se2$1@news.codecharge.com...
> > > > > Hi Don,
> > > > >
> > > > > Thanks for the info. I am a VERY newbee and I am still having
> problems
> > > > with
> > > > > getting this to work.
> > > > > I am using a Microsoft Access database. The connection I have is
> > called
> > > > > DBWTTMembership, so I just substituted the DBconnection1 with
that.
> > > > > The table of all the the members is called "members". The email
> field
> > is
> > > > > called "email".
> > > > > The desired catagory field (called "desired_catagory") is a field
> that
> > > > will
> > > > > gets inserted into the "postings" table of the same database.
> > > > > I want this function to run when a posting is inserted into the
> > postings
> > > > > table - so I intend on placing the code at the "after insert"
> section.
> > > > >
> > > > > I already have CDONTS email working. I tested it using a single
test
> > > send
> > > > > and it worked.
> > > > >
> > > > > This is what I have so far:
> > > > >
> > > > > Function ==================
> > > > > Dim rs
> > > > >
> > > > > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > > > > Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
> > > > catagory
> > > > > = '" & desired_catagory.value & "'")
> > > > >
> > > > > While not rs.EOF
> > > > >
> > > > > 'Send Email @12-24842035
> > > > >
> > > > > With CreateObject("CDONTS.NewMail")
> > > > > .From =Me@MyDomain.com
> > > > > .To = rs.Fields("email")
> > > > > .Subject = "A match has been found""
> > > > > .Body = "The body will contain text and fields from the
> table
> > > > > postings"
> > > > > .BodyFormat = 1
> > > > > .MailFormat = 0
> > > > > .Send
> > > > > End With
> > > > >
> > > > > 'End Send Email
> > > > >
> > > > > Wend
> > > > >
> > > > > set rs = Nothing
> > > > >
> > > > > End Function ==================
> > > > >
> > > > > Can you tell me where I went wrong.
> > > > > Thanks.
> > > > > Anthony.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > > > >news:bdq6gb$3ou$1@news.codecharge.com...
> > > > > > I assume that there is a "email" column in the Membership table
> with
> > > > their
> > > > > > email address in it?
> > > > > >
> > > > > > If your database supports stored procedures (is it SQL Server?).
> > Then
> > > > I'd
> > > > > > write a stored procedure to send them from there. If stored
> > > procedures
> > > > > are
> > > > > > "out", then you'll have to write code in the AfterExecute Insert
> and
> > > > > > AfterExecuteUpdate events to send the email. Dim a recordset
and
> > use
> > > it
> > > > > to
> > > > > > retrieve the email addresses:
> > > > > >
> > > > > > (my example variable and object names are made up, so interprete
> > > > > > accordingly)
> > > > > >
> > > > > > Dim rs
> > > > > >
> > > > > > If DBconnection1.state <> 1 Then DBconnection1.Open
> > > > > > Set rs = DBconnection1.Execute("SELECT emailaddress FROM
> Membership
> > > > WHERE
> > > > > > catagory = '" & desired_catagory.value & "'")
> > > > > >
> > > > > > While not rs.EOF
> > > > > > Call emailprogram (strMessage, strSubject, strFrom,
> > > > > > rs.Fields("emailaddress")
> > > > > > Wend
> > > > > >
> > > > > > set rs = Nothing
> > > > > >
> > > > > > The "emailprogram" part is where things get dicey. I happen to
> > prefer
> > > > > > Persits' ASPEmail object (http://www.persits.com). You may not
> > have
> > > > it,
> > > > > > but instead have something else available. You may find you
can't
> > use
> > > > ANY
> > > > > > 3rd party stuff due to your host's restrictions.
> > > > > >
> > > > > > That said, the Persits object is really easy to install and use
> and
> > is
> > > > > > extremely well-documented on their site. They offer a "basic"
> > version
> > > > for
> > > > > > free as well as a reasonably-priced full-up version. You don't
> need
> > > > > > anything but the basic version to do what you are asking to do.
> > > > > >
> > > > > > --
> > > > > > DonB
> > > > > >
> > > > > > http://www.gotodon.com/ccbth
> > > > > >
> > > > > >
> > > > > >
> > > > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > > > >news:bdngf5$jng$1@news.codecharge.com...
> > > > > > > I would like to be able to email a subset of members in my
> > database
> > > > > after
> > > > > > a
> > > > > > > record is inserted into the database.
> > > > > > > I want the subset of members filtered by a field in the
database
> > > > record
> > > > > > that
> > > > > > > was submitted.
> > > > > > >
> > > > > > > The database form that gets filled out looks something like
> this:
> > > > > > >
> > > > > > > Name:
> > > > > > > Address:
> > > > > > > City:
> > > > > > > State:
> > > > > > > Zip:
> > > > > > > Catagory:
> > > > > > >
> > > > > > > The catagory's can vary, such as: music, art, math, etc...
> > > > > > >
> > > > > > > In the member table I have a field called "desired_catagory"
> which
> > > the
> > > > > > > member entered their catagory preference such as "music" for
> > > example.
> > > > > > >
> > > > > > > If a user fills out the database form and enters a catagory of
> > > > "music",
> > > > > I
> > > > > > > would like
> > > > > > > this information emailed to ALL the matching members in the
> > members
> > > > > table
> > > > > > > that have
> > > > > > > selected "music" in their desired_catagory.
> > > > > > >
> > > > > > > I am using CodeCharge Studio with ASP coding.
> > > > > > > I am linking to my database called Membership.mdb
> > > > > > > The table that contains the member information is called
> members.
> > > > > > >
> > > > > > > Any help is appreciated.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Anthony :)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

GRQNET
Posted: 07/04/2003, 12:14 PM

Hi Don,
Thanks, I tried the rs.Close now I am getting the following error even after
I remove the rs.Close statement.
Confused.

ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/WttDatabase/email/MemberEmailRecord_events.asp, line 19
=======HERE IS THE CURRENT CODE ===================

Function MemberEmails_AfterInsert() 'MemberEmails_AfterInsert @2-800E96EB

Dim rs

If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
Set rs = DBWTTMembership.Execute ("SELECT email FROM members Where AND
MembershipLevel_ID = " & MemberEmails.SentTo.Text)

While not rs.EOF

'Send Email @13-6962F8CA
With CreateObject("CDONTS.NewMail")
.From =Me@MyDomain.com
.To = rs.Fields("email")
.Subject = MemberEmails.Subject.Text
.Body = MemberEmails.Message.Text
.BodyFormat = 1
.MailFormat = 0
.Send
End With
'End Send Email

rs.MoveNext

Wend
set rs = Nothing
DBWTTMembership.Close

' rs.Close ' I tried this then removed it.

End Function 'Close MemberEmails_AfterInsert @2-54C34B28





"DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
news:bdul1a$utg$1@news.codecharge.com...
> Hmmm, you can try explicitly closing the recordset: rs.Close
>
> Do this right before you set it to Nothing.
>
> It is interesting how you used the "With". I've never seen that done
> before. Maybe you would be better off Set-ting a variable that you can
then
> set to Nothing afterwards.
>
> It's always a good idea to do this to objects to be sure they terminate.
>
> Donb
>
>
>
> "GRQNET" <Webmaster@grq.net> wrote in message
>news:bdtjar$l6s$1@news.codecharge.com...
> > One more problem.
> > I thought I had this working. But for some reason it doesn't work
> > consistently.
> > I started to get a server error "Too Many Client Tasks" and nothing
ran.
> > I realized that I needed to close the database so, I added the
> > DBWTTMembership.Close line at the end.
> > My provider reset the server for me and now for some reason, the script
no
> > longer works.
> > My provider said that the problem must be with the code since they
tested
> > the CDONTS works.
> > I tested a single email form using Cdonts and it worked.
> > Any help is appreciated. I wish I knew coding better.. I am learning
but
> > it's slow.
> > If you can also let me know any good sources for learing this code, that
> too
> > would be appreciated.
> > Thanks.
> > Anthony.
> >
> >
> > Here is the final code I am using that is not working:
> >
> > The WTTMailingList is a checkbox that the member checks if they want the
> > mailings.
> > The MemberEmails.SentTo.text is a group number from 1 to 5. Choosing 1
> > sends emails to all the basic members, etc...
> >
> >
> > Function MemberEmails_AfterInsert() 'MemberEmails_AfterInsert
@2-800E96EB
> >
> > Dim rs
> >
> > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > Set rs = DBWTTMembership.Execute ("SELECT email FROM members Where
> > MembershipLevel_ID = " & MemberEmails.SentTo.Text & " AND WTTMailingList
=
> > True")
> >
> > While not rs.EOF
> >
> > 'Send Email @13-6962F8CA
> > With CreateObject("CDONTS.NewMail")
> > .From = "Info@mydomain.com"
> > .To = rs.Fields("email")
> > .Subject = MemberEmails.Subject.Text
> > .Body = MemberEmails.Message.Text
> > .BodyFormat = 1
> > .MailFormat = 0
> > .Send
> > End With
> > 'End Send Email
> >
> > rs.MoveNext
> >
> > Wend
> > set rs = Nothing
> > DBWTTMembership.Close
> >
> > End Function 'Close MemberEmails_AfterInsert @2-54C34B28
> >
> >
> >
> >
> >
> >
> >
> > "GRQNET" <Webmaster@grq.net> wrote in message
> >news:bdt0l3$uh8$1@news.codecharge.com...
> > >
> > > That did it!
> > > Thank you!
> > > Anthony.
> > >
> > >
> > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > >news:bdr0p5$63a$1@news.codecharge.com...
> > > > you are missing one important thing that I can see - the
rs.movenext -
> > to
> > > > step through the records. I assume your while loop never
terminates?
> > > >
> > > > Donb
> > > >
> > > > .
> > > >
> > > > Paste the code in there and you should be all set.
> > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > >news:bdqpbm$se2$1@news.codecharge.com...
> > > > > Hi Don,
> > > > >
> > > > > Thanks for the info. I am a VERY newbee and I am still having
> problems
> > > > with
> > > > > getting this to work.
> > > > > I am using a Microsoft Access database. The connection I have is
> > called
> > > > > DBWTTMembership, so I just substituted the DBconnection1 with
that.
> > > > > The table of all the the members is called "members". The email
> field
> > is
> > > > > called "email".
> > > > > The desired catagory field (called "desired_catagory") is a field
> that
> > > > will
> > > > > gets inserted into the "postings" table of the same database.
> > > > > I want this function to run when a posting is inserted into the
> > postings
> > > > > table - so I intend on placing the code at the "after insert"
> section.
> > > > >
> > > > > I already have CDONTS email working. I tested it using a single
test
> > > send
> > > > > and it worked.
> > > > >
> > > > > This is what I have so far:
> > > > >
> > > > > Function ==================
> > > > > Dim rs
> > > > >
> > > > > If DBWTTMembership.state <> 1 Then DBWTTMembership.Open
> > > > > Set rs = DBWTTMembership.Execute("SELECT email FROM members WHERE
> > > > catagory
> > > > > = '" & desired_catagory.value & "'")
> > > > >
> > > > > While not rs.EOF
> > > > >
> > > > > 'Send Email @12-24842035
> > > > >
> > > > > With CreateObject("CDONTS.NewMail")
> > > > > .From =Me@MyDomain.com
> > > > > .To = rs.Fields("email")
> > > > > .Subject = "A match has been found""
> > > > > .Body = "The body will contain text and fields from the
> table
> > > > > postings"
> > > > > .BodyFormat = 1
> > > > > .MailFormat = 0
> > > > > .Send
> > > > > End With
> > > > >
> > > > > 'End Send Email
> > > > >
> > > > > Wend
> > > > >
> > > > > set rs = Nothing
> > > > >
> > > > > End Function ==================
> > > > >
> > > > > Can you tell me where I went wrong.
> > > > > Thanks.
> > > > > Anthony.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "DonB" <7432D63DBB01D03A196B1EDD80E8@comcast.net> wrote in message
> > > > >news:bdq6gb$3ou$1@news.codecharge.com...
> > > > > > I assume that there is a "email" column in the Membership table
> with
> > > > their
> > > > > > email address in it?
> > > > > >
> > > > > > If your database supports stored procedures (is it SQL Server?).
> > Then
> > > > I'd
> > > > > > write a stored procedure to send them from there. If stored
> > > procedures
> > > > > are
> > > > > > "out", then you'll have to write code in the AfterExecute Insert
> and
> > > > > > AfterExecuteUpdate events to send the email. Dim a recordset
and
> > use
> > > it
> > > > > to
> > > > > > retrieve the email addresses:
> > > > > >
> > > > > > (my example variable and object names are made up, so interprete
> > > > > > accordingly)
> > > > > >
> > > > > > Dim rs
> > > > > >
> > > > > > If DBconnection1.state <> 1 Then DBconnection1.Open
> > > > > > Set rs = DBconnection1.Execute("SELECT emailaddress FROM
> Membership
> > > > WHERE
> > > > > > catagory = '" & desired_catagory.value & "'")
> > > > > >
> > > > > > While not rs.EOF
> > > > > > Call emailprogram (strMessage, strSubject, strFrom,
> > > > > > rs.Fields("emailaddress")
> > > > > > Wend
> > > > > >
> > > > > > set rs = Nothing
> > > > > >
> > > > > > The "emailprogram" part is where things get dicey. I happen to
> > prefer
> > > > > > Persits' ASPEmail object (http://www.persits.com). You may not
> > have
> > > > it,
> > > > > > but instead have something else available. You may find you
can't
> > use
> > > > ANY
> > > > > > 3rd party stuff due to your host's restrictions.
> > > > > >
> > > > > > That said, the Persits object is really easy to install and use
> and
> > is
> > > > > > extremely well-documented on their site. They offer a "basic"
> > version
> > > > for
> > > > > > free as well as a reasonably-priced full-up version. You don't
> need
> > > > > > anything but the basic version to do what you are asking to do.
> > > > > >
> > > > > > --
> > > > > > DonB
> > > > > >
> > > > > > http://www.gotodon.com/ccbth
> > > > > >
> > > > > >
> > > > > >
> > > > > > "GRQNET" <Webmaster@grq.net> wrote in message
> > > > > >news:bdngf5$jng$1@news.codecharge.com...
> > > > > > > I would like to be able to email a subset of members in my
> > database
> > > > > after
> > > > > > a
> > > > > > > record is inserted into the database.
> > > > > > > I want the subset of members filtered by a field in the
database
> > > > record
> > > > > > that
> > > > > > > was submitted.
> > > > > > >
> > > > > > > The database form that gets filled out looks something like
> this:
> > > > > > >
> > > > > > > Name:
> > > > > > > Address:
> > > > > > > City:
> > > > > > > State:
> > > > > > > Zip:
> > > > > > > Catagory:
> > > > > > >
> > > > > > > The catagory's can vary, such as: music, art, math, etc...
> > > > > > >
> > > > > > > In the member table I have a field called "desired_catagory"
> which
> > > the
> > > > > > > member entered their catagory preference such as "music" for
> > > example.
> > > > > > >
> > > > > > > If a user fills out the database form and enters a catagory of
> > > > "music",
> > > > > I
> > > > > > > would like
> > > > > > > this information emailed to ALL the matching members in the
> > members
> > > > > table
> > > > > > > that have
> > > > > > > selected "music" in their desired_catagory.
> > > > > > >
> > > > > > > I am using CodeCharge Studio with ASP coding.
> > > > > > > I am linking to my database called Membership.mdb
> > > > > > > The table that contains the member information is called
> members.
> > > > > > >
> > > > > > > Any help is appreciated.
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Anthony :)
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.