473,394 Members | 2,063 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,394 software developers and data experts.

Microsoft access reports/queries

Hi,

I have a question. I have a table of several records each record contains about 20 columns and of course several rows. I would like to generate a query which checks each cell (not each record) and if the cell has a 0 then I want to generate a report that doest not include the value in the cell ( 0 ) nor the name of the cell. I just want to completely ignore the value and the name when generating the report. It can be in VB or a SQL statement that's ok. Is this possible?

Thanks
Jun 29 '10 #1
11 1698
jimatqsi
1,271 Expert 1GB
Ummm, you are going to read this post later and feel a little silly. You've just told us what you don't want to report. What do you want to report?

If the name is a column name, what if row 1 has a zero and row 2 does not? Then what, one test says include the 'name' and one test says do not include the name. Or do you mean a person's name is one of the 20 rows and you want to exclude the person on that row because he has a zero in one of the columns.

It's an interesting puzzle. Tell us more.

Jim
Jun 30 '10 #2
NeoPa
32,556 Expert Mod 16PB
I can't say it's impossible as Access can be quite flexible really. It's certainly not simple and I can't imagine a scenario where it might make sense. You appreciate if the data is shown at cell level then each cell would require the column label displayed on each record? Because a cell is missing does not mean that all cells for that column would necessarily also be missing.

I would suggest you give the whole concept a little more consideration, to understand fully what it would involve. Not as a technical problem, but rather as to how it would work logically.

Welcome to Bytes!
Jun 30 '10 #3
thelonelyghost
109 100+
I agree with NeoPa here. The system you're proposing seems like it's poorly formed unless it's for an uber specific situation. I can think of a situation where you may use this, but I can already think of an alternative that's a higher normal form.

Example: Members of a religious organization are part of different committees at different levels. 0 means that they aren't part of that committee whereas 1, 2, 3, etc. indicates their seniority within said committee. This provides for members being part of multiple committees at different levels of seniority.

Fix: Assign each member a unique ID if you haven't already. Create a table with four fields: RecordID, MemberID, Committee, and Seniority. RecordID is a simple autonumber to easily keep track of each record. MemberID is each member's unique ID, mentioned earlier. Committee is the name of the field you took the number from. Seniority is the value from the field you took the number from, i.e. "3".

This makes it much easier to produce a report to exclude all "0" values since they won't even be entered into the new table, as well as a multitude of other benefits involving a higher normal form.
Jun 30 '10 #4
I appreciate all the responses; let me try to explain the situation a little better.

Example: I have a table with 3 columns the names are C1,C2 and C3 (3 columns per row) column C1 contains a unique ID that Identifies the record. The value in C2 or C3 can change from 0 to 5. So let's say C1 contains the ID (value)=1 and C2 contains a value of 0 and C3 contains the value of 3. The user would like to generate a report for ID=1 so the code would have to check if the value in C2 and/or C3 is zero in this case C2 would be zero then the report should Only display C1 and C3 and completely ignore C2's value and name.
Jun 30 '10 #5
NeoPa
32,556 Expert Mod 16PB
Have you considered how this data would be displayed if C2's value and name are absent from a line? Bear in mind the absence of a name implies no information to identify which column it's related to.
Jun 30 '10 #6
@NeoPa
Hi NeoPa Thanks for your input. Well, what do you think of this approach: fetching the record and searching for any columns that contain a zero, deleting these columns and creating a table with the new non-zero columns then generate the report and finally delete the table? This might be challenging but I can't think of any other way.
Jun 30 '10 #7
NeoPa
32,556 Expert Mod 16PB
This sounds very much like you're thinking in Excel. I'm sorry to say this doesn't really work in Access (or any database type environment really).

The best you'll get is to separate out the data into records including the ID and one of the columns. Each of the columns could be handled this way and the results joined together using a UNION ALL query. It would almost certainly need to include both the data and an indicator as to which column it's from. This points strongly at very poorly organised data though.

Perhaps it would be better to take a few steps backwards and consider the real-world application you have in mind, then consider which approach would best fit this.
Jun 30 '10 #8
@NeoPa
Thanks to all that reply. I think I just found a solution it is not the most elegant solution but it will do the job. I will use 2 SQL statements:

1) SELECT INTO temp FROM Main this will create a new table with the required ID.

2) DELETE FROM Temp I will use the Temp table to delete any zeros (since there will only be one record at this point) then I can generate the report from this table.

Thanks All.
Jun 30 '10 #9
NeoPa
32,556 Expert Mod 16PB
That's very much along the lines I proposed (Not recommended. I couldn't recommend such an approach.) except that you use a temporary table within the process, and you don't appear to have allowed for multiple columns. You do appreciate that you will need various INSERT INTO statements for each of the other columns you want to cover don't you?

PS. You shouldn't need the DELETE statement at all. If each of the SELECT INTO statements are properly filtered there will be none to delete.
Jul 1 '10 #10
NeoPa
32,556 Expert Mod 16PB
I can see this as being quite complicated for someone to follow without either a fair amount of experience or an example to look at. I cannot increase your experience so I'll show you a quick example.

Starting with a table of :
Table = [tblData]
Expand|Select|Wrap|Line Numbers
  1. Field
  2. ID
  3. Col1
  4. Col2
  5. Col3
The first SQL would be along the lines of :
Expand|Select|Wrap|Line Numbers
  1. SELECT [ID]
  2.       ,'Col1' AS [Col]
  3.       ,[Col1] AS [Data]
  4.        INTO [tblTemp]
  5. FROM   [tblData]
  6. WHERE  [Col1] IS NOT NULL
The following SQL would be duplicated with minor changes for each subsequent column :
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO [tblTemp] ([ID]
  2.                       ,[Col]
  3.                       ,[Data])
  4. SELECT      [ID]
  5.            ,'Col2'
  6.            ,[Col2]
  7. FROM        [tblData]
  8. WHERE       [Col2] IS NOT NULL
No need for deleting any entries later.
Jul 1 '10 #11
NeoPa
32,556 Expert Mod 16PB
Using the same table layout, the UNION version would be :
Expand|Select|Wrap|Line Numbers
  1. SELECT [ID]
  2.       ,'Col1' AS [Col]
  3.       ,[Col1] AS [Data]
  4. FROM   [tblData]
  5. WHERE  [Col1] IS NOT NULL
  6. UNION
  7. SELECT [ID]
  8.       ,'Col2'
  9.       ,[Col2]
  10. FROM   [tblData]
  11. WHERE  [Col2] IS NOT NULL
  12. UNION
  13. SELECT [ID]
  14.       ,'Col3'
  15.       ,[Col3]
  16. FROM   [tblData]
  17. WHERE  [Col3] IS NOT NULL
This doesn't need a temporary table and also has less, and simpler, SQL.
Jul 1 '10 #12

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

Similar topics

1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
4
by: Mike Thomas | last post by:
Access 2000 - Is there a 3rd party tool available, or perhaps some method built into Access 2000, which could isolate unused Access reports, queries, forms, etc? I have a 5 year old app which...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
3
by: NickJ | last post by:
Dear all, I've encountered an unusual problem having just recently upgraded an Access 97 database to Access 2000 format and was hoping somebody could point me in the direction of a solution. ...
1
by: Brian Barnes | last post by:
I've been searching using google trying to find a way to display Access Reports via ASP.NET and only finding commericial products which appear to require that the report needs to be converted every...
2
by: Max | last post by:
I am editting a database created in access 2003 by another programmer. This person has left the company for which the database was created and no documentation. So that I could work on this...
0
by: dkurtz | last post by:
D. Lesandrini published an article some time ago about exporting Access reports as XML, and then updating those XML reports dynamically in ..NET....
16
by: JoeW | last post by:
I'm utilizing a database that I created within MS Access within a program I've created in VB.NET. I am using the VB front end to navigate the information, but want to be able to print a report,...
3
by: VANWEB | last post by:
A developer gave me a Microsoft Access Application approximately 42MB that I had him design. I can open the application itself and see the Access GUI with the buttons & menu he created, but I...
0
by: flomaster | last post by:
Hi, I have created a c# application which uses Microsoft Access Reports. The application works ok on my laptop but when I installed it on other pcs ( more than 5 ) the following problem appears. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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...
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.