473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in running or open the query

12 New Member
Hi Everybody..

This is my firstime in creating report using microsoft access.
Actually i need to build a report based on a database call Table1.
I only use 2 column of databse to put in my report.

1) State
2) Status

For status, i need to separate it based on value of status;
Eg: 1)Ready
2) Not ready

I had create 2 query,one for ready and one for not ready.
I combine this 2 query into one query called StateStatus to build the report.

When i run or open to view the StateStatus query,the error message occur.I only can view it by design view.

Error:
The query can not be completed either the size of the query result is larger than the maximum size of databse (2GB) or there is not enough temprary storage space on the disk to store the query result.


Is it my step to create query for report is wrong?
How to solve to make the query can run or open.


Thank you.
Jun 30 '08 #1
14 3565
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. It sounds like you have accidentally multiplied your two queries when you tried to join them back to each other. This is known as the Cartesian product of the rows, and happens when you include the tables but neglect to join them on the relevant common field. I'm not sure what you want to do with the two fields you mention - Status and State - but the most obvious thing is to group by the values concerned and count the rows for each state.

You don't need two queries to do this. Simplest approach is to use the Access query editor, add your primary table to the query, use View, Totals to select grouping and totalling, add the state and status fields, then add a copy of the status field, giving it a different name (Count of Status, say) and change its Group By to Count.

-Stewart
Jun 30 '08 #2
nico5038
3,080 Recognized Expert Specialist
It would be easy for us when you would post a sample you need like:
Expand|Select|Wrap|Line Numbers
  1. State Ready NotReady
  2. UK      123       33
  3. DK       22        5
  4. etc...
  5.  
This can be done by a groupby query or a crosstable query.

Nic;o)
Jul 1 '08 #3
akmaRudiliyn
12 New Member
Thank you Stewart Ross Inverness and nico5038 for your help.

Yes, actually i want to have the same structure that had stated by nico5038,
but i dont know how to do.
Actually Status have 3 value.

1)Ready
2)Not Ready
3)Nothing

I already done the query but it is not work. It only show for Status Ready,
but Status Not Ready and Nothing are not showed. Maybe my query is wrong.

My query:

SELECT State, Count(Status) AS Status1
FROM Table1
WHERE (Status='Ready' )
GROUP BY State

UNION

SELECT State, Count(Status) AS Status2
FROM Table1
WHERE (Status='Not Ready')
GROUP BY State

UNION

SELECT State, Count(Status) AS Status3
FROM Table1
WHERE (Status='Nothin g')
GROUP BY State;

Anyone can help me?
Jul 2 '08 #4
Stewart Ross
2,545 Recognized Expert Moderator Specialist
As Nico said, you can do this as a group by or crosstab query. There is no need for the union-query approach. The group-by version, which shows counts for each Status on separate rows, is:
Expand|Select|Wrap|Line Numbers
  1. SELECT State, Count(Status) AS StatusCount FROM Table1 GROUP BY State, Status;
The Crosstab version, which shows all status values as column headings, is:
Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Count([Status]) As StatusCount
  2. SELECT State From Table1
  3. GROUP BY State
  4. PIVOT Status;
-Stewart
Jul 2 '08 #5
nico5038
3,080 Recognized Expert Specialist
Or the ultimate "GroupBy does it all in one query" solution:

Expand|Select|Wrap|Line Numbers
  1. SELECT State
  2. , Sum(IIF(Status='Ready',1,0)) AS Ready
  3. , Sum(IIF(Status='Not Ready',1,0)) AS NotReady
  4. , Sum(IIF(Status='Nothing',1,0)) AS Nothing
  5. , Sum(IIF(IsNull(Status),1,0)) AS Empty
  6. FROM Table1
  7. GROUP BY State
  8.  
Nic;o)
Jul 2 '08 #6
akmaRudiliyn
12 New Member
Thank you again to Stewart Ross Inverness and nico5038 for help me.

Now my problem is solved. Thank you so much :).I want to ask another question.
Below is my query same as nico5038 give before. I just use it because look simple.

My query:

SELECT Language,
Sum(IIf(State=' UK',1,0)) AS State1,
Sum(IIf(State=' EGYPT',1,0)) AS State2,
Sum(IIf(State=' RUSIA',1,0)) AS State3,
Sum(IIf(State=' MEXICO',1,0)) AS State4,
Count([No TG]) As TGAmount,
--abcdefg--
FROM Student
GROUP BY Language;


At --abcdefg-- space,
actually i want to make a query that can count all the value of [No TG] group by State.
how can i combine the query?

(SELECT Count([No TG]) AS (TotalTG) From [Maklumat Pelajar] GROUP BY State)

Once again..anyone can help me? :)
Jul 3 '08 #7
nico5038
3,080 Recognized Expert Specialist
Just switch the Language field by the [No TG] field and see the effect.

Nic;o)
Jul 3 '08 #8
akmaRudiliyn
12 New Member
Thank you all for helping me.

1) I had sort my data in ascending order A-Z,but it is not sort properly. Why it is happen? How to solve it?

Eg:

C
B
A
A,B
A,B,
B


2) I also want to know the right way to filter use Visual Studio .net. Let say i want to filter the column <Blank> and Brunei for State row.

Eg:

State
<Blank>
Brunei
Singapore
Rusia
Jul 7 '08 #9
akmaRudiliyn
12 New Member
Below is my code to filter data. I want to arrange the data by state from north to south. First, Perlis, 2nd Perak and so on until Sabah. But the data is still sort by a-z(ascending) or z-a(descending) order. For example, Johor, Kedah,Kelantan. .Terengganu..I dont want this order.

Anyone can check my query below..

SELECT State,
Sum(IIf(Status= 'Ready',1,0)) AS Ready,
Sum(IIf(Status= 'Not Ready Aktif',1,0)) AS NotReady,
Sum(IIf(Status= 'Cancel',1,0)) AS Cancel,
Sum(IIf(Status= 'Nothing',1,0)) AS Nothing,
Sum(IIf(IsNull( Status),1,0)) AS Empty,
Count(*) AS Total
FROM Table1

WHERE
((State='Perlis '
Or State='Kedah'
Or State='Perak'
Or State='P.Pinang '
Or State='Kuala Lumpur'
Or State='Selangor '
Or State='Melaka'
Or State='N.Sembil an'
Or State='Pahang'
Or State='Terengga nu'
Or State='Kelantan '
Or State='Johor'
Or State='Sabah'
Or State='Sarawak' ))

GROUP BY Negeri

ORDER BY
((State='Perlis '
Or State='Kedah'
Or State='Perak'
Or State='P.Pinang '
Or State='Kuala Lumpur'
Or State='Selangor '
Or State='Melaka'
Or State='N.Sembil an'
Or State='Pahang'
Or State='Terengga nu'
Or State='Kelantan '
Or State='Johor'
Or State='Sabah'
Or State='Sarawak' ));

Anyway, this code is not work. It still sort data by ascending or descending, not follow as i arrange. Anyone can help me?Maybe my query is wrong.
Jul 7 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2219
by: Christopher Brandsdal | last post by:
Hi! I have a problem running my code on 2000 server and iis5.0. The code runs perfectly on my localhost (xp iis5.1) but when i run it on 2000 server iis5.0 I get this error: -------------------------------------- operation must use an updateable query
5
9537
by: George Copeland | last post by:
This is a request for help fixing a SQL Server 2000/ADO problem on Windows XP. I would appreciate any useful assistance. PROBLEM: SQL Server access on my machine fails as follows: 1. All of my VB6 apps reference the following ADO typelib: Microsoft ActiveX Data Objects 2.7 Library Located at: c:\Program Files\Common Files\System\ADO\msado27.tlb
6
3046
by: wireless | last post by:
I've had my SQL server database running for two years now without a problem. However, just today one of the main tables started returning an error. The table is contained within a database called engineering. I back it up once a week and the file size is up to about 40 MB. The error returned when trying to return data from one table (DbLucent) is:
4
3820
by: Marcin Zmyslowski | last post by:
Hello everyone! I have the following problem. I`ve opened a Query Analyser and write the statement: -isql -S 'PL6XXXX' -i 'd:\SQL_Server_2000\Raport_WWW.sql' I got the following erorr message: Incorrect syntax near -S
0
1352
by: Javier Fernandez | last post by:
We just migrate out p690 from kernel 32 bits to kernel 64 bits in order to migrate DB2 v7 to DB2 v8 FP3. The only problem without a solution we find out is since we did the change we cannot run multiple (simultaneous) queries from a PC to the database. I mean in release v7 I use to open multiple Showcase Strategy queries and run them at the same time... or while running a query start defining a new one by selecting tables and so on......
8
9511
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for each person for whom a mail merge letter is desired. The query reads address info from the table for each record where is true.
7
6928
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports the status of the machines. Upon we follow the .NET object lifetime recommendations the application is constantly consuming more memory! The problem is on the ManagementObjectSearch, upon we Dispose the object it seems that is not releasing the...
1
3472
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select count_big(*) from sys.objects s1, sys.objects s2, sys.objects s3, sys.objects s4, sys.objects s5 PRINT GETDATE()
9
5752
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just call it Express for simplicity). I have, to try to simplify things, put the exact same DB on two systems, one running MSDE and one running Express. Both have 2 Ghz processors (one Intel, one AMD), both have a decent amount of RAM (Intel system...
0
8397
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
8310
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,...
0
8827
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, 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...
0
8732
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
8503
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
7333
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...
0
5632
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();...
0
4158
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...
2
1957
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.