473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Looping a table as a Where clause and send emails.

I seem to have gotten over my head, but this seems fairly
straightforward..

I have a table of items assigned to a rep, and I have a rep list table
created from the original table ( to show only reps in the main
table).

I want to be able to send and email to each rep with only their
items.
I know I will have to have a loop statement that will take the reps
name and use that in a variable to be able to send it to each rep by
name. How do I sync that with the query?
I've got something like this:
Dim i As Integer
Dim strRep As String

For i = 1 To TblTempRep.Count
strRep = TblTempRep.Rep
DoCmd.SendObject acSendQuery, qryEmailRep, acFormatXLS, strRep
Next i

But I'm not sure if this is correct, or if this would be the proper
way.

I would think that using SQL would be easier than making a query and
passing the variable back to it through a function ( at least I think
that's how you would do it), but I don't have the knowledge to get the
SQL sent as a excel spreadsheet either.

I hope that makes sense, and thanks in advance for your time.

Oct 9 '07 #1
1 1580
Have just done something similar to send membership renewal forms to Club
members. Very long winded, but I will give you some pointers.
Firstly. because the Invoice is quite complicated I can't send it as an RTF
file as the formatting would be lost. so I send it as a PDF file attachment.

You need the loop of your reps and I use an SQL for this
I use a PDF995 printer driver which is configured to save the file as a
fixed name e.g. RepRpt.PDF, so I delete RepRpt.PDF, I have a routine to
create the appropriate report for the Member (Rep) in question which I now
save as the new RepRpt.PDF. Then I have another routine using the Outlook
Application from the Microsoft Outlook object library to send the email and
attach the PDF file

Lots of coding. watch out for writer's cramp

Phil
<ba****@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
>I seem to have gotten over my head, but this seems fairly
straightforward..

I have a table of items assigned to a rep, and I have a rep list table
created from the original table ( to show only reps in the main
table).

I want to be able to send and email to each rep with only their
items.
I know I will have to have a loop statement that will take the reps
name and use that in a variable to be able to send it to each rep by
name. How do I sync that with the query?
I've got something like this:
Dim i As Integer
Dim strRep As String

For i = 1 To TblTempRep.Count
strRep = TblTempRep.Rep
DoCmd.SendObject acSendQuery, qryEmailRep, acFormatXLS, strRep
Next i

But I'm not sure if this is correct, or if this would be the proper
way.

I would think that using SQL would be easier than making a query and
passing the variable back to it through a function ( at least I think
that's how you would do it), but I don't have the knowledge to get the
SQL sent as a excel spreadsheet either.

I hope that makes sense, and thanks in advance for your time.

Oct 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Thom McGrath | last post by:
I'm writing a simple mailing list program, and I would like to know what the suggested method of sending a large number of emails to a list of addresses. (sounds like spam, no?) It's perfectly...
6
by: RdR | last post by:
Hi, Has anyone encountered infinite looping in Q Replication? This happens when I have a source DB2 table A going to a target DB2 table B, it also happens that the samne target table B is...
1
by: Robert Davis | last post by:
I would like to be able to create a recordset in MS Access 2000 that allows a macro to run and create a report for each ID that appears in the recordset. So I thought that I would use a scheduling...
3
by: Roger Withnell | last post by:
I have a framed website. I plan to include in default.asp a routine to check if the annual subscription is due from the records in the People table. If so, then the routine would send emails...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
1
by: Dirk Goossens | last post by:
Hi everybody I have a table containing a list of E-mail adresses. Is it possible to send an E-mail (one by one) to all the adresses? Is it also possible to add an attachment? Thanks for the...
4
by: Hemant Shah | last post by:
Folks, Our client has a program that browses whole table from begining to end. The table has 1 million rows in it. REORGCHK does not show any problems. It has unique index defined on KEY0...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, My company will be hosting a webcast, and I need to send out 2000 individual emails to people who signed up (for login information...). I created an smtp app that I can loop through...
20
by: raddrummer | last post by:
Hi there, I'm woking on a function that takes the input from a form (including Payroll Contact), uses it as a query parameter, runs the query, and then emaills out a custom .xls file using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.