472,372 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,372 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 1800
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
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.