473,836 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Coun t
strRep = TblTempRep.Rep
DoCmd.SendObjec t 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 1600
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.c omwrote in message
news:11******** **************@ 22g2000hsm.goog legroups.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.Coun t
strRep = TblTempRep.Rep
DoCmd.SendObjec t 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
4817
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 legit, it's just an opt-in mailing. I have a feeling that using a 'while' loop with repeated calls to mail() is not the best practice. Is there something better I should be doing?
6
2354
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 replicated back to source table A (true bi-directional replication scenario). Once I start replication on a master to master scenario the changes in A gets replicated to B but that change gets replicated back to A and so on creating an infinite loop. Is...
1
2778
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 program to start the database and then have an AutoExec Macro start the process. My issue is that I can not seem to get any results to generate a report. I am somewhat confused as to what the difference is in DAO and ADDO. Here is the code...
3
1723
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 to those who are due and update the table that this had been done, so that it is only done once. If session 1 is doing just this, session 2 (and 3 and n) could be doing the same thing.
13
5032
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 several questions / senarios: * I created several stored procedures that take parameters and inserts the data into the appropriate tables. This was done for easy access/use from client side apps (i.e. web-based).
1
1388
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 helping hands!!! -- Dirk Goossens
4
3724
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 column. If I use SELECT statement without OPTIMIZE FOR clause, then it uses temporary table to sort the data, but if I use OPTIMIZE clause then it uses index access without temporary table. If I use OPTIMIZE FOR more than 700 rows then it uses...
0
1685
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 which uses smtp and our Exchange mail server. The smtp app works fine. I tested it on 10 test emails and called Client.Send 10 times. The emails went through (I emailed myself). My question is if anyone knows if Exchange server would be bogged...
20
2241
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 sendObject method to the Payroll Contact specified in a list. After perfroming this function it loops to the next person on the list and requeries to send them a custom list. The problem: After sending the first list the first query will not...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10570
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7772
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3100
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.