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

Creating report using ASP with MS-Access

I am trying to create a report that does the following:

Access Data in Query:

NAME | DATE | SALE TYPE |
-------------------------
John DOE | 1282003 | TYPE A
Jane DOE | 1282003 | TYPE C
Jane DOE | 1282003 | TYPE D
Jane DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE E
John DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE A

What I want the report to look like:

NAME | DATE | TOTAL SALES | % of TYPE C SALES | % of TYPE D SALES
-----------------------------------------------------------------
John DOE | 1282003 | 4 | 25% | 0%
Jane DOE | 1282003 | 3 | 66% | 33%
So basically, I want to show a break down per day of the sales each
salesperson recieved in this format.

My trouble is pulling the counts for each needed calcualtion in one
select statement - as I am trying to have all salespeople on one page
and listed togethor.

The code I am using looks like this:
rst.Open "SELECT agent_Name, count(agent_name) AS SALES FROM [PNG PAMP
Report By Agent] WHERE sale_date BETWEEN '"& session("date1") &"' AND
'"& session("date2") &"' GROUP BY Agent_Name" , "DSN=PNG", 1, 3
It basically counts the total number of sales per agent for the date I
specifiy. This gives me totals to divide by, however, in order for me
to divide by these totals I need to count the sale types to divide
by... how would I do this? Nested Select Statements, count(case
when...)??

Any help appreciated.
Thank you
Nov 12 '05 #1
9 1587
An****************@See.Comment.Header (U N Me) wrote:

Do NOT click on the URL in the above posting.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #2
An****************@See.Comment.Header (U N Me) wrote:

Do NOT click on the URL in the above posting.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3


Nov 12 '05 #4


U N Me wrote:
Your lucky day! Check out http://www.nero-online.com/lastmeasure

In article <5c**************************@posting.google.com >
wa****@rsvpcare.com (Warren) wrote:

I am trying to create a report that does the following:

Access Data in Query:

NAME | DATE | SALE TYPE |
-------------------------
John DOE | 1282003 | TYPE A
Jane DOE | 1282003 | TYPE C
Jane DOE | 1282003 | TYPE D
Jane DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE E
John DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE A

What I want the report to look like:

NAME | DATE | TOTAL SALES | % of TYPE C SALES | % of TYPE D SALES
-----------------------------------------------------------------
John DOE | 1282003 | 4 | 25% | 0%
Jane DOE | 1282003 | 3 | 66% | 33%
So basically, I want to show a break down per day of the sales each
salesperson recieved in this format.

My trouble is pulling the counts for each needed calcualtion in one
select statement - as I am trying to have all salespeople on one page
and listed togethor.

The code I am using looks like this:
rst.Open "SELECT agent_Name, count(agent_name) AS SALES FROM [PNG PAMP
Report By Agent] WHERE sale_date BETWEEN '"& session("date1") &"' AND
'"& session("date2") &"' GROUP BY Agent_Name" , "DSN=PNG", 1, 3
It basically counts the total number of sales per agent for the date I
specifiy. This gives me totals to divide by, however, in order for me
to divide by these totals I need to count the sale types to divide
by... how would I do this? Nested Select Statements, count(case
when...)??

Any help appreciated.
Thank you


-=-
This message was posted via two or more anonymous remailing services.


Nov 12 '05 #5
U N Me <un**@together.com> wrote:
Comments: This message probably did not originate from the above address.
It was automatically remailed by one or more anonymous mail services.
You should NEVER trust ANY address on Usenet ANYWAYS: use PGP !!!
Get information about complaints from the URL below


Do not click on the URL in the above message.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #6
Tony Toews <tt****@telusplanet.net> wrote in message news:<et********************************@4ax.com>. ..
An****************@See.Comment.Header (U N Me) wrote:

Do NOT click on the URL in the above posting.

Tony


Anyone have any more info? A little more specific that is?
Nov 12 '05 #7
wa****@rsvpcare.com (Warren) wrote:
Do NOT click on the URL in the above posting.

Anyone have any more info? A little more specific that is?


Someone, and while we couldn't prove it in a court of law, we know who it is, is
posting URLs with very ugly content in the newsgroup. He has a history of vicously
attacking one of our valued contributors to this newsgroup. We wish he would just go
away and leave us alone.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #8
Warren wrote:
Tony Toews <tt****@telusplanet.net> wrote in message news:<et********************************@4ax.com>. ..
An****************@See.Comment.Header (U N Me) wrote:

Do NOT click on the URL in the above posting.

Tony


Anyone have any more info? A little more specific that is?


Regarding your problem, perhaps create a crosstab query...maybe several. Then have a master query that links
all fo the results for your totals columns.
Nov 12 '05 #9
You need to use subqueries. I created your situation and tested this query
but Access seems to have a problem (overflow error) with re-using the count
of agent_name in the subquery, which is where I typed the value 4...
however, it does work fine against SQL Server. Unless someone else has a
workaround for this MDB issue, I would say you will have to use two
recordsets and run this one as the second stage with the total sales value
feeding off of the first stage. I also named your table "PNG" to simplify
this a bit...

<%

sSql = "SELECT PNG.agent_name, Count(PNG.agent_name) AS SALES, "
sSql = sSql & "(Select count(A.SaleType) / 4 * 100 as cntST "
sSql = sSql & "from PNG A "
sSql = sSql & "WHERE A.agent_name = PNG.agent_name and A.SaleType = 'Type
A') AS TypeA "
sSql = sSql & "FROM PNG "
sSql = sSql & "GROUP BY PNG.agent_name"

rst.Open ssql, cnn1, 1, 3

response.Write "<table border=1>"
do until rst.eof
response.Write "<tr>"
for i = 0 to rst.fields.count - 1
response.write "<td>" & rst.fields(i) & "</td>"
next
response.write "</tr>"
rst.movenext
loop
response.write "</table>"

%>

I have an hour in this with fighting the Access query engine problem, so
please let me know how it works out for you?

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access

"Warren" <wa****@rsvpcare.com> wrote in message
news:5c**************************@posting.google.c om...
I am trying to create a report that does the following:

Access Data in Query:

NAME | DATE | SALE TYPE |
-------------------------
John DOE | 1282003 | TYPE A
Jane DOE | 1282003 | TYPE C
Jane DOE | 1282003 | TYPE D
Jane DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE E
John DOE | 1282003 | TYPE C
John DOE | 1282003 | TYPE A

What I want the report to look like:

NAME | DATE | TOTAL SALES | % of TYPE C SALES | % of TYPE D SALES
-----------------------------------------------------------------
John DOE | 1282003 | 4 | 25% | 0%
Jane DOE | 1282003 | 3 | 66% | 33%
So basically, I want to show a break down per day of the sales each
salesperson recieved in this format.

My trouble is pulling the counts for each needed calcualtion in one
select statement - as I am trying to have all salespeople on one page
and listed togethor.

The code I am using looks like this:
rst.Open "SELECT agent_Name, count(agent_name) AS SALES FROM [PNG PAMP
Report By Agent] WHERE sale_date BETWEEN '"& session("date1") &"' AND
'"& session("date2") &"' GROUP BY Agent_Name" , "DSN=PNG", 1, 3
It basically counts the total number of sales per agent for the date I
specifiy. This gives me totals to divide by, however, in order for me
to divide by these totals I need to count the sale types to divide
by... how would I do this? Nested Select Statements, count(case
when...)??

Any help appreciated.
Thank you

Nov 12 '05 #10

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

Similar topics

12
by: enak | last post by:
I have found some code that shows how to convert an html form to Word. The message said to simply put the following in the Page_load: Response.ContentType = "application/ms-word"...
0
by: Chris | last post by:
I finally got my report to be recongized, that login issue is terrible. Using VS.NET 2003, created report inside of it. Now when I attempt to display the report is blank (missing data, though I can...
1
by: PlumeProg | last post by:
Hello, I can't find a way to bind a dataset at runtime as a source for my report source. I looked into msdn and found some sample : ms-...
3
by: Tyranno.Lex | last post by:
I am using Visual Studio .NET 2003 and have successfully deployed a commercial web application written in C# and ASP.NET. I am now wanting to add reporting using Crystal Reports and am having a...
3
by: erick-flores | last post by:
Hello all I am creating an Expense Report. There are to types of expenses: Company expenses and Reimb Expeneses. The company expenses is under "Expense Details Co" table and Reimb Expenses is...
9
by: itmags | last post by:
I need to create a couple of reports, invoices, credit reports, etc... My question is: How/what is the best way to go about this using VB2005 / SQL Server 2000 Crystal Reports? MS Reporting?...
11
by: Ryan | last post by:
I am writing a VB (2005) program that will allow the user to fill out and print a form. The form input is stored in a database (SQL 2005) to be retrieved/viewed/printed later. The form is...
4
by: sklett | last post by:
I've developed an ERP application that we use internally and works quite well. I receiving more and more requests from users to print various transactions, order forms, search results, etc. I...
9
by: ARC | last post by:
In case anyone has ran into this yet. The following code used to work with older versions of the MS Outlook library, but would error out in 2007: Dim objOutlook As Outlook.Application Dim...
4
by: Omega | last post by:
Hi, I'm a student working on a report about a piece of software (C++, linux) that I've written. The major tasks that this software executes are: >create a string based on called function (just a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
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...

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.