473,385 Members | 1,693 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,385 software developers and data experts.

Macro that e-mails one report using a different query for each rep/e-mail

I have created a database that brings in a new table weekly. I then
made a separate query for each sales rep and a separate report for each
rep. (The reports are all identical but call different queries.)
Lastly, I created a macro that sends the reports to the respective rep
via e-mail with the push of a button.

I am pleased with myself for getting this far but I realize the next
step is figure out how to use one report (so I don't have to change 10
when I need to make changes)that calls the different queries.

I would be happy if the macro had ten lines in it that call the report,
each time with a different query, obviously then sending it to the
appropriate rep.

It seems to me there must be a simple solution.

Nov 13 '05 #1
1 1876
On 21 Dec 2004 12:06:31 -0800, "Chasing Gates" <ja***@dolomiteusa.com>
wrote:
I have created a database that brings in a new table weekly. I then
made a separate query for each sales rep and a separate report for each
rep. (The reports are all identical but call different queries.)
Lastly, I created a macro that sends the reports to the respective rep
via e-mail with the push of a button.

I am pleased with myself for getting this far but I realize the next
step is figure out how to use one report (so I don't have to change 10
when I need to make changes)that calls the different queries.

I would be happy if the macro had ten lines in it that call the report,
each time with a different query, obviously then sending it to the
appropriate rep.

It seems to me there must be a simple solution.

Hi
You can call the openreport macro with a where condition which selects
the rep the report will be for, see the help file if you are lucky
enough to have one, here is an extract
Where Condition: A valid SQL WHERE clause (without the word
WHERE) or expression that Microsoft Access uses to select records from
the report's underlying table or query. If you select a filter with
the Filter Name argument, Microsoft Access applies this WHERE clause
to the results of the filter.To open a report and restrict its records
to those specified by the value of a control on a form, use the
following expression:[fieldname] = Forms![formname]![controlname on
form]The fieldname argument is the name of a field in the underlying
table or query of the report you want to open. The controlname on form
argument is the name of the control on the form that contains the
value you want records in the report to match.
Note The maximum length of the Where condition argument is 256
characters. If you need to enter a more complex SQL WHERE clause
longer than this, use the OpenReport method of the DoCmd object in
Visual Basic instead. You can enter SQL WHERE clause statements of up
to 32,768 characters in Visual Basic.

David

Nov 13 '05 #2

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

Similar topics

1
by: Steve | last post by:
I am using Access 2000 and I have a DB that is currently running four different queries from some Forms and subforms. These queries each have a date field that are seperate from each other that are...
3
by: Prakash Wadhwani | last post by:
Hi !! I have been browsing around but have not been able to find a simple, lucid solution ... or maybe I'm just too confused. I know this has been asked before by many ... but pls bear with me. ...
0
by: Chasing Gates | last post by:
I currently have the tables set up and a separate query for each individual sales rep. I then created 10 reports and a macro that sends out the ten reports via e-mail to the correct reps. I...
0
by: ghadley_00 | last post by:
MS Access Create form / report with multiple pages using different background images Hi, Would like to have users fill out a multipage form, and then click a print button, which pulls up the...
2
by: kaosyeti | last post by:
hey... i have a quarterly report that i'm working on where each of the 12 or so pages is completely different from the other. all are based on basically the same info (ergo, the same query) but...
4
by: Jimmy | last post by:
I have a form with a command button on it that is supposed to open up a report and use a query to populate it. DoCmd.OpenReport "rptMailingList", acViewPreview, "qryMailingListChristmas" ...
2
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a report that is based on a crosstab query. One of the fields in the crosstab query is based on a query. It is a coded value. When I look at the crosstab query it displays the...
1
by: giovannino | last post by:
Dear all, I did a query which update a sequence number (column NR_SEQUENZA) in a table using a nice code (from Trevor !). 1) Given that I'm not a programmer I can't understand why...
0
by: saifulhaque | last post by:
Dear All How we can assign column of table to Crystal report using sql query. Means sq l query is varying w.r.t purpose. Ex: Some times select * from table or Some times...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
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,...

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.