473,651 Members | 2,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_nam e) 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 1603
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_nam e) 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****@teluspl anet.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****@teluspl anet.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.SaleTyp e) / 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.coun t - 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****@rsvpcar e.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
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_nam e) 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
4160
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" Response.AddHeader("content-disposition", "inline; filename=BP_CaseStatus.doc") Now all I should have to do is create the page just like I would if I were going to display it in the browser.
0
1765
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 see the viewer, report fields, etc.) I've tried setting the rpt.SetDataSource(dstConcernInfo) in the reports VB code behind and my viewer code-behind page. No luck. I've displayed my dataset to see that it's full. I assume that the report can't...
1
4156
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- help://MS.VSCC/MS.MSDNVS/crystlmn/html/crtskaccessingsecure databases.htm ' Declare require variables. Dim logOnInfo As New TableLogOnInfo()
3
3044
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 devil of a time doing this. The problem is that my application uses an encapsulated data tier for accessing the database vs. accessing it directly via the client tier. However, EVERY example that I have ever seen for creating a Crystal Report at...
3
1664
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 under "Expense Details" table. So I am creating this final report to see both type of expenses separately but I CANT. I got this report design from a website, but it only came with one "Expense Details" table, so I add the Expense Details Co. The...
9
9411
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? Home brew using print document? (Program to be distributed thoughout this office and possibly to a few other organizations that have expressed an interest). I've taken a couple of stabs at this and either this is more
11
1963
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 originally a Word Document, I also have this form as a PDF. Appearance and quality is critical for this form.. so what I thought I'd do is convert the form to a bitmap, use a picture object on my VB form and overlay textbox (no border) controls on top...
4
3663
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 haven't decided what the best way to do this is because I don't have much experience with generating printable forms. Early on I knew one of my modules would need to print a clear report so I used the open source SharpPDF library to generate the...
9
2240
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 objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Set objOutlook = CreateObject("Outlook.Application") ' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
4
2080
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 couple of integers converted to 'chars') >open a thread (using pthread_create) - main thread: start (deadlock) timer - new thread: execute client functions for (wireless) communication (send string to server) >main thread checks for answer...
0
8349
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, 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...
0
8695
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
8460
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
8576
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 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...
0
7296
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
6157
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
5609
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();...
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.