I have a table with a location ID; multiple locations per ID. I need to loop throught that table and create new tables for each location ID so that I can send a report out to each location, containing only the data for that location ID.
I also have the email address of the location stored in the same table.
How can I loop through this single table, or maybe just filter it programmaticall y somehow for each location ID and then send an email with just the filtered results as an Excel attachment using the email address associated with each location ID?
4 2215
I have a table with a location ID; multiple locations per ID. I need to loop throught that table and create new tables for each location ID so that I can send a report out to each location, containing only the data for that location ID.
I also have the email address of the location stored in the same table.
How can I loop through this single table, or maybe just filter it programmaticall y somehow for each location ID and then send an email with just the filtered results as an Excel attachment using the email address associated with each location ID?
this could go either way...depending on how your table is layed out.
can you give an brief data sample?
if you already have a report built that shows ALL locations, then we're ahead of the game.
you can use the sendobject command to send a report but in order to get the e-mail address out of the table, along with the ID, then wwe need to know more info.
For example, if I do a simple query to say "Select * from yourtable group by ID;"
will I get say 5 different locations each with a different e-mail address?
For example, if I do a simple query to say "Select * from yourtable group by ID;"
will I get say 5 different locations each with a different e-mail address?
Yes, that's exactly right. There multiple records per location, and each location has a different email address.
this could go either way...depending on how your table is layed out.
can you give an brief data sample?
if you already have a report built that shows ALL locations, then we're ahead of the game.
you can use the sendobject command to send a report but in order to get the e-mail address out of the table, along with the ID, then wwe need to know more info.
For example, if I do a simple query to say "Select * from yourtable group by ID;"
will I get say 5 different locations each with a different e-mail address?
Yes I do have a table that shows ALL locations. If you can help me figure out just the email piece I'd really appreciate it. It's been a while since I posted this.
Thank you!
Yes I do have a table that shows ALL locations. If you can help me figure out just the email piece I'd really appreciate it. It's been a while since I posted this.
Thank you!
Here is a code excerpt from a function written to loop through a table and send e-mails. I'm not clear yet how many addresses will go on each of your e-mails....but the method here will give you a starting point -
Dim rs As DAO.Recordset
-
Dim strEmailRec as string
-
Dim strSubject as string
-
Dim strMessageText as string
-
-
Set rs = CurrentDb.OpenRecordset("SELECT * FROM YourLocationTable")
-
Do While Not rs.EOF
-
strEmailRec = rs.Fields("[email]").Value
-
strSubject = "Your Subject"
-
strMessageText = "Your Message"
-
'Send the e-mail with the spreadsheet attached. Change TRUE to FALSE if you don't want to review the e-mail
-
DoCmd.SendObject acQuery, "YourQuery, "MicrosoftExcel(*.xls)", EmailRec, "", "", strSubject, strMessageText, True, ""
-
rs.MoveNext
-
Loop
-
J
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gustavo Randich |
last post by:
The following seems to be a bug. The execution returns rows 1,2. It
should return 1,1. In fact, if I run the code within a stored procedure
alone (not in a trigger), the loop doesn't overwrite the value of y
(works well).
create table test (a integer)
@
create table debug1 (a integer)
@
create trigger test_1 after insert on test referencing new as ins for
|
by: Rob Mazur |
last post by:
Hi. I'm trying to create a query that pulls information
from 3 seperate tables. Here's how I want it to work:
User is prompted for SSN
Table 1:
SSN
Name
Gender
|
by: JC |
last post by:
Hi,
I have a database that imports 4 reports to my "data" table, each
report has its own identifier. Then I have a table with Analysts with
the report identifier that they are to be assigned to. What I need to
do is loop the two tables so that an Analyst is assigned to each
record in the "data" table based on the identifier. For example, I
have one analyst that needs to be assigned to the "H" report records,
one analyst that needs to...
|
by: jlee |
last post by:
I'm pretty much a newbie on mysql, and I need some help.
I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4
(i386) on a server hosting an active website.
The site's developer uses his own php shopping cart to receive customer
orders.
The configuration was done via cPanel with no external modifications -
which produced no protests when built, ran and connected with no
|
by: free4trample |
last post by:
First of all let me say that I know very little about javascript.
what i need to do is to write a javascript functin which will change
the background color of the table rows based on entrees in the table.
See an example of the webpage that the script will work with here:
http://igorpetrusky.awardspace.com/RunStats.html
now, at the top there will be 3 buttons, which will call javascript
functions that will operate on tables 2 through N. ...
| |
by: MP |
last post by:
Hi
trying to begin to learn database using vb6, ado/adox, mdb format, sql
(not using access...just mdb format via ado)
i need to group the values of multiple fields
- get their possible variations(combination of fields),
- then act on each group in some way ...eg ProcessRs (oRs as RecordSet)...
the following query will get me the distinct groups
|
by: Paul H |
last post by:
Suppose I have a table called tblPeople and I want a field to illustrate
whether each person prefers cats or dogs. I could do it one of three ways.
1. A plain text field
Create a text field in tblPeople called PreferredPet.
2. A lookup field that stores text values.
Create a text field in tblPeople called PreferredPetID and use it to lookup
an identical text field in tblPreferredPets.
|
by: gillianbrooks91 |
last post by:
Forgive me for asking this question, I've trawled through nearly every
available post on this subject that I can find for a few weeks now but
nothing quite points me in the right direction.
I'm quite new to trying to mess around with VB and ADO within MS
Access and have realised the steep learning curve I have, but, I want
to try and solve this problem quickly and was wondering if anyone
would help me out??
I want to be able to...
|
by: TG |
last post by:
hi!
I am trying to create a sql server table from an excel sheet.
Here is the code I have:
'This procedure the xlsx file and dumps it to a table in SQL Server
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |