This topic is locked

Group Email Help

3/22/2009 10:33:29 AM
ASPRunnerPro General questions
B
bhicks11 author

I'm trying to email everyone in the Team Members table when adding a new record. I've pieced together some of the suggestions I found in this forum but I'm getting an error - Object doesn't support this property or method. Any help is appreciated. Heres the code:
Dim dkeys

dim all_emails
str = "select [Contact Email] from [TEAM MEMBERS - LOG BOOK COVER PAGE]"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

all_emails = ""
while not rstmp.eof

all_emails = all_emails & rstmp("Contact Email") & ","

rstmp.Movenect

wend
all_emails = left(all_emails,Len(all_emails)-1)

rstmp.close

set rstmp=nothing
message ="This is an auto-nofication that your ONLINE NPDES LOG BOOK has been updated. " & vbcrlf & vbcrlf
message = message & " " & "APPROVED EROSION & SEDIMENT CONTROL PLAN" & vbcrlf & vbcrlf
dkeys = dict.keys
message = message & " " & dict("Document") & vbcrlf & vbcrlf
message = message & "Please login to your project at www.jvgconsult.com/NPDES/login.asp, print the new document and include in your on-site hard-copy log book. " & vbcrlf & vbcrlf
message = message & dict("Notes") & vbcrlf & vbcrlf
message = message & vbcrlf & vbcrlf & "Me" & vbcrlf & "JVG Engineering, Inc." & vbcrlf & "www.jvgconsult.com"; & vbcrlf & "999-999-9999"
email=all_emails
subject="ONLINE NPDES LOG BOOK AUTO NOTIFICATION" & " - " & dict("Project")
sendmail email, subject, message
BeforeAdd = True

B
bhicks11 author 3/22/2009

Sorry - I got it! I had to put the SENDEMAIL stuff in the lookp.
Thanks anyway!

B
bhicks11 author 3/22/2009

Sorry - I got it! I had to put the SENDEMAIL stuff in the lookp.

Thanks anyway!


OOPS - I spoke too soon. How would I filter the select? Here's what I have that causes and error:
str = "select [Contact Email] from [TEAM MEMBERS - LOG BOOK COVER PAGE] WHERE [TEAM MEMBERS - LOG BOOK COVER PAGE].[Project]=[APPROVED EROSION & SEDIMENT CONTROL PLAN].[PROJECT]"
WHERE [TEAM MEMBERS - LOG BOOK COVER PAGE].[Project]=[APPROVED EROSION & SEDIMENT CONTROL PLAN].[PROJECT]" is causing the error but how do I only show the emails for TEAM MEMBERS that have the same Project as APPROVED EROSION & SEDIMENT CONTROL PLAN?
Thanks in advance.
Bonnie

J
Jane 3/23/2009

Bonnie,
try to use this one:

str = "select [Contact Email] from [TEAM MEMBERS - LOG BOOK COVER PAGE],[APPROVED EROSION & SEDIMENT CONTROL PLAN] WHERE [TEAM MEMBERS - LOG BOOK COVER PAGE].[Project]=[APPROVED EROSION & SEDIMENT CONTROL PLAN].[PROJECT]"

B
bhicks11 author 3/23/2009

Bonnie,

try to use this one:


Thanks Jane. I did finally get it to work with this:
mSQL = "select [Contact Email] from [TEAM MEMBERS - LOG BOOK COVER PAGE] WHERE Project = '" & dict("Project") & "'"
I appreciate your response because it helps understand how to do other queries also.