multiple query criteria

Let's start with the fact that I am an Access novice, so if this looks like I 
am way off base, and cannot get any guidance here, just let me know.
  
     What I have is a table listing vehicle inspection standards.  A vehicle 
tag number, and then 50 fields such as, wipers inop, headlight inop, etc.  
My fields are numeric, because there is a point system used to determine a 
pass/fail.
     I input the tag number, and if the specific area is deficient, I enter 
either a 10 or a 25 for point values.
     What I end up with, is a table with tag numbers and then fields showing 
points deducted from the overall 100%.

What I want to do is run a report that lists the vehicle tag number, and 
only the fields identified with a numeric penalty (10 or 25).  There will 
never be all 50 fields on the report, at most, five or six of the areas will 
be marked as having a deficiency.  If I put "IS NOT NULL" in the design grid 
for each of the fields, my report comes back empty.  Is there a way to make 
this work?
Any help would be much appreciated.
Thank You

0
Utf
5/1/2010 7:25:01 PM
access.queries 6343 articles. 1 followers. Follow

4 Replies
859 Views

Similar Articles

[PageSpeed] 28

On Sat, 1 May 2010 12:25:01 -0700, olive <olive@discussions.microsoft.com>
wrote:

>Let's start with the fact that I am an Access novice, so if this looks like I 
>am way off base, and cannot get any guidance here, just let me know.

Well, if you're way off base, you may get more guidance not less <g>... take
it for what it's worth.

>     What I have is a table listing vehicle inspection standards.  A vehicle 
>tag number, and then 50 fields such as, wipers inop, headlight inop, etc.  
>My fields are numeric, because there is a point system used to determine a 
>pass/fail.

That is in fact a less than ideal table design. Each vehicle has many (50)
InspectionPoints; each InspectionPoint applies to many vehicles. This kind of
many to many relationship is better handled with three tables: Vehicles
(probably using the tag number or VIN as the primary key); a fifty row (today,
you might have more points next year if the legislature or agency adds some)
table of Points; and a Rating table with fields for the TagNumber, PointID,
and Points.

>     I input the tag number, and if the specific area is deficient, I enter 
>either a 10 or a 25 for point values.

With the normalized design a subform with a combo box selecting the
InspectionPoint and storing the points for that issue would be ideal.

>     What I end up with, is a table with tag numbers and then fields showing 
>points deducted from the overall 100%.
>
>What I want to do is run a report that lists the vehicle tag number, and 
>only the fields identified with a numeric penalty (10 or 25).  There will 
>never be all 50 fields on the report, at most, five or six of the areas will 
>be marked as having a deficiency.  If I put "IS NOT NULL" in the design grid 
>for each of the fields, my report comes back empty.  Is there a way to make 
>this work?

Not easily with your wide flat design. Trivially easy with the normalized
table.

Any chance you could correct the table design? If not post back, it's doable
with a UNION query; just a lot more work.


>Any help would be much appreciated.
>Thank You
-- 

             John W. Vinson [MVP]
0
John
5/1/2010 9:54:16 PM
It is just about possible with your existing table.  One way is a UNION query
as John mentioned, but with 50 separate columns this would be cumbersome.
There is another way, which is to manipulate the report's layout in code in
its module at runtime so that Null columns are hidden and those with data are
repositioned on a vehicle by vehicle basis.  This is not trivial, however,
and once again the total number of columns involved would make the code
extensive.  I would not recommend either approach.

The only sensible solution is to normalize the database design by
'decomposing' your table into a set of related tables along the lines John
has described.  If each vehicle can have more than one inspection, however, e.
g. annually, then you'd need to go introduce one more table, so what you'd
have would be the following tables:

Vehicles
….TagNumber (primary key)
….<other columns representing vehicle attributes>

InspectionCategories
….CategoryID (autonumber primary key)
….Category

This table would have one row per category, e.g. 'wipers inop' etc.

Inspections
….InspectionID (autonumber primary key)
….InspectionDate
….TagNumber

The TagNumber in this is table a foreign key referencing the primary key of
Vehicles

InspectionDetails
….InspectionID
….CategoryID
….Points

The primary key of this table is a composite one made up of InspectionID and
CategoryID.  Individually each of these columns is a foreign key referencing
the keys of Inspections and Categories respectively.

Each of the above tables represents an 'entity type' with the columns in each
table representing attributes which are specific to that entity type.  This
is how a relational database works.  The InspectionDetails table represents a
special kind of entity type because it also models a many-to-many-
relationship between Inspections and Categories.  By having separate columns
for each inspection category in your table you are doing what is known as
'encoding data as column headings'.  This breaks one of the fundamental rules
of the relational model, the 'information rule' which requires all data to be
stored as values at column positions in rows in tables and in no other way.
As you've found out this leads to practical difficulties in using the
database.

With a correctly normalized design as above creating a report becomes very
simple.  All that's necessary is to join the tables in a query like so:

Vehicles---<Inspections---<InspectionDetails>---Categories

Include the columns from each table which you need in your report and base
the report on the query.  Group the report first by Vehicle, then by
Inspection, with a group header for each and include the Category and Points
in the detail section.  For each vehicle inspection the report will only
include those categories for which there are data.  If you wish you can sum
the points in a text box in a group footer for the Inspection group to give
the total points per vehicle inspection.

If you have a manageable amount of data at present you might be able to
renter the data manually into the new model, being sure to fill the Vehicles
and Categories tables first, followed by the Inspections table, and finally
the InspectionDetails table.  With a large amount of existing data you can
largely automate the process by using append and update queries, but with
your 50 separate columns, while not a difficult task, this would nevertheless
be a tedious one.  Which ever is the case I would recommend that you bite the
bullet, though, as to persist with your current flawed design is only going
to give rise to more problems in the future.  We shall of course be happy to
guide you through the process.

Ken Sheridan
Stafford, England

olive wrote:
>Let's start with the fact that I am an Access novice, so if this looks like I 
>am way off base, and cannot get any guidance here, just let me know.
>  
>     What I have is a table listing vehicle inspection standards.  A vehicle 
>tag number, and then 50 fields such as, wipers inop, headlight inop, etc.  
>My fields are numeric, because there is a point system used to determine a 
>pass/fail.
>     I input the tag number, and if the specific area is deficient, I enter 
>either a 10 or a 25 for point values.
>     What I end up with, is a table with tag numbers and then fields showing 
>points deducted from the overall 100%.
>
>What I want to do is run a report that lists the vehicle tag number, and 
>only the fields identified with a numeric penalty (10 or 25).  There will 
>never be all 50 fields on the report, at most, five or six of the areas will 
>be marked as having a deficiency.  If I put "IS NOT NULL" in the design grid 
>for each of the fields, my report comes back empty.  Is there a way to make 
>this work?
>Any help would be much appreciated.
>Thank You

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201005/1

0
KenSheridan
5/2/2010 12:50:10 PM
For some reason, my last two replies did not post.  I hope they all don't 
show up at once, if so, please forgive the repetitiveness (is that a word?)  
Anyway,
I took your advice and corrected my table structure.

I now have three tables.

Table 1, Vehicles - has vehicle tag number, vin, and specific user

Table 2, PointID - has PointId (with my 50 inspection items), and the value 
of each item 10 or 25points.

Table 3, Ratings - has three fields, TagNumber, PointID, and Points.

Now, I have table 2 and 3 related by pointId, and Table 1 and 3 related by 
Tag Number.

Just to establish my next step.
I should create a form to input the tag#, inspection item, and points into 
my ratings table.  From this table I should be generating my queries and 
reports?

If this sounds good, let me know and I will press on with making my form and 
queries.
Thanks so much for the help
Olive


"John W. Vinson" wrote:

> On Sat, 1 May 2010 12:25:01 -0700, olive <olive@discussions.microsoft.com>
> wrote:
> 
> >Let's start with the fact that I am an Access novice, so if this looks like I 
> >am way off base, and cannot get any guidance here, just let me know.
> 
> Well, if you're way off base, you may get more guidance not less <g>... take
> it for what it's worth.
> 
> >     What I have is a table listing vehicle inspection standards.  A vehicle 
> >tag number, and then 50 fields such as, wipers inop, headlight inop, etc.  
> >My fields are numeric, because there is a point system used to determine a 
> >pass/fail.
> 
> That is in fact a less than ideal table design. Each vehicle has many (50)
> InspectionPoints; each InspectionPoint applies to many vehicles. This kind of
> many to many relationship is better handled with three tables: Vehicles
> (probably using the tag number or VIN as the primary key); a fifty row (today,
> you might have more points next year if the legislature or agency adds some)
> table of Points; and a Rating table with fields for the TagNumber, PointID,
> and Points.
> 
> >     I input the tag number, and if the specific area is deficient, I enter 
> >either a 10 or a 25 for point values.
> 
> With the normalized design a subform with a combo box selecting the
> InspectionPoint and storing the points for that issue would be ideal.
> 
> >     What I end up with, is a table with tag numbers and then fields showing 
> >points deducted from the overall 100%.
> >
> >What I want to do is run a report that lists the vehicle tag number, and 
> >only the fields identified with a numeric penalty (10 or 25).  There will 
> >never be all 50 fields on the report, at most, five or six of the areas will 
> >be marked as having a deficiency.  If I put "IS NOT NULL" in the design grid 
> >for each of the fields, my report comes back empty.  Is there a way to make 
> >this work?
> 
> Not easily with your wide flat design. Trivially easy with the normalized
> table.
> 
> Any chance you could correct the table design? If not post back, it's doable
> with a UNION query; just a lot more work.
> 
> 
> >Any help would be much appreciated.
> >Thank You
> -- 
> 
>              John W. Vinson [MVP]
> .
> 
0
Utf
5/5/2010 5:05:02 PM
On Wed, 5 May 2010 10:05:02 -0700, olive <olive@discussions.microsoft.com>
wrote:

>For some reason, my last two replies did not post.  I hope they all don't 
>show up at once, if so, please forgive the repetitiveness (is that a word?)  
>Anyway,
>I took your advice and corrected my table structure.
>
>I now have three tables.
>
>Table 1, Vehicles - has vehicle tag number, vin, and specific user
>
>Table 2, PointID - has PointId (with my 50 inspection items), and the value 
>of each item 10 or 25points.

50 rows, not 50 fields... right??

>Table 3, Ratings - has three fields, TagNumber, PointID, and Points.

Yep!

>Now, I have table 2 and 3 related by pointId, and Table 1 and 3 related by 
>Tag Number.
>
>Just to establish my next step.
>I should create a form to input the tag#, inspection item, and points into 
>my ratings table.  From this table I should be generating my queries and 
>reports?

Yes. It's a *bit* redundant to have both the PointID and the Points in the
Ratings table, since in principle you could just store the PointID and use a
query to look up the points; but I'm guessing that the number of points might
change over time, or even be a variable (a trivial, minor or serious violation
of an inspection point might score 5, 10 and 25 points), if not now then in
the future.

If so you'll need a smidgen of VBA code or a one-line macro to record the
points. I'd see a Form based on your Vehicles table, with a Subform based on
Ratings. On the Subform you would have a Combo Box or Listbox based on the
PointID table, with the PointID, a text description of the point (unless the
person using the database has all 50 ID's memorized), and the Points value.
The combo's Control Source would be the PointID, and you could put a macro or
VBA code in the combo's AfterUpdate event to push the combo's Points value
into the Points field on the subform:

Private Sub cboPoints_AfterUpdate()
If Not IsNull(Me!cboPoints) Then ' did the user select a row?
  Me!Points = Me!cboPoints.Column(2) ' the third field, it's zero based
End If
End Sub
-- 

             John W. Vinson [MVP]
0
John
5/5/2010 8:30:48 PM
Reply:

Similar Artilces:

Removing multiple hyperlinks
I've got data copied into my spreadsheet that includes hyperlinks. Ther are thousands of these in a column. I can remove individually by right-clicking and selecting Hyperlink an Remove. I can then arrow down and do a control Y, cell by cell, What I want to do is highlight the column and be able tp remove th hyperlinks all at once. I've exhausted myself peering through knowlegebases and groups, bu cannot find any way to make this work. Thanks for any input you can provide -- Message posted from http://www.ExcelForum.com Hi one way: Use the following macro to remove hyperlinks...

Create a list with multiple criteria
I have a data base with 1,000's of addresses w/zipcodes (Sheet 1 columns A to E, E being zipcodes). After setting a base address I get all of the zipcodes within a given radius (in this case 70 zipcodes), listed in Sheet 2, Column A. Next, I use COUNTIF (in column B) to find how many addresses are in each zipcode, in this example there are 46 addresses within the 70 zipcodes. What I want to do is create a list in sheet three that will list each with the data from Sheet 1 columns A to E). Any help would be appreciated. Ronbo ...

Charting multiple multiples
Hopefully I can explain this in a way that will be understood. Data: Place A Place B Place C FWD Back FWD BACK FWD Back Org_1 1 2 3 2 1 3 Org_2 2 5 4 6 1 4 I would like to place the data so that FWD and Back data is stacked on top of each other in different colors, and placed in one row on a 3-D chart as Org-1 and a second row as Org_2. Any ideas? Thanks. If you arrange your data like this: Back FWD Org_1 Place A 2 1 Place B 2 3 Place C 3 1 Org_2 Place A 5 2 ...

Multiple Hyperlinks In Same Shape Doesn't Work
Can anyone tell me how I can get multiple hyperlinks in the same shape to work? I have no problem inserting the hyperlinks, but they all point to only one. I scoured these posts, and found this (http://groups.google.com/groups?q=hyperlink+group:microsoft.public.visio.*&hl=en&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.visio.*&selm=3eea6467%241%40news.microsoft.com&rnum=2), which doesn't appear to work. Thanks in advance-- RAD Um, which version of Visio are you using? As far as I know, at least Visio 2002 and Visio 2003 support multiple hyperlinks. Can't...

Attempting to display only certain records related to user criteria input
I have an Excel spreadsheet with 100 records. Each record contains columns of information with one of those columns being age. What would like to do is have the user fill in a cell at the top of the pag and then have only those records meeting that criteria be displayed. For example, "Show records where age exceeds ____". If the user input 34 in the blank, then only those records where the value in the ag column exceeds 34 would be displayed. If the user then changes thei input to 15, then only those records where the value in the age colum exceeds 15 would be displayed. At fi...

Multiple Profiles, multiple accounts, multiple machine configuring?
Is there a vb or related method of adding *both* profiles *and* email accounts to multiple users logins from the administrator account? I have a network which is a workgroup (NOT a domain), in which there are about 15 users that are replicated on each of 5 machines. I'd like to be able to add all 15 Mail Profiles, and all 15 email accounts to each of the 15 logins on these 5 machines--obviously with as little work as possible. The mail is all retrieved from the same Exchange Server, but these machines *cannot* be added to a domain (don't ask!). I'd hate to have to log into ...

Date in the query is always short date
I want to capture the LONG date from a query, so I create a parameter for the date (mm ddd yy) . In its properties, it's format is long date, BUT it always shows up the short date. WHY? Dates are stored as decimal number counting days from 12/31/1899 midnight with time as the decimal fraction of a day. Formats are just different ways to display the information. So you got to set the format. In design view of the query click the field of the grid that has the datetime field, right click, scroll down and select Properties. Click 'Format' and then in the pull down...

Counting dates with specific criteria
Hi, I have a column with various dates, I need some formulae to count different criteria. The criteria are: 1. Dates in the current month. 2. Dates last month. 3. dates in a calender year. 4. Dates in a financial year. Each criteria will be shown in seperate cells on a different worksheet on Excel 2003, also the current month is always the current month as we progress through the year. Thanks in advance, -- Steve Try these... 1. Dates in the current month. =SUMPRODUCT(--(TEXT(A2:A21,"myyyy")=TEXT(NOW(),"myyyy"))) 2. Dates last month. =SUMPRO...

DAP query question
I have a bunch of data access pages set up. Working showing the data for a particular data. I have new plans and need to have a date range choosen by a user on the page itself, then that data to be shown for the entered range. so the query would be a select query summing with the date criteria being between [startdate] and [enddate] problem is how do i either create a calendar control or two drop downs on the page itself that the user can change to view the nessisary data. Im assuming a command button will also be needed. is there a way to pass the values from controls on a dap to the que...

Single click selects multiple cells
When clicking on a single cell multiple cells are selected. The one time solution for this is to zoom in or out. This is problematic as 60% seems to be the zoom that works most of the time but at this zoom level the cell contents do not display. The time lost and the frustration that builds is killing my productivity and office attitude. Please give all of us a permanet fix. -- Thanks Mike ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" butt...

Suppressing Values in Autofilter Criteria List
Hello, I'm not a VBA guy, but I think what I'm trying to do can only get done with some lines of code. Any help would be appreciated. I've a fairly large data set that I'd like to be able to apply advanced filters to. I would like the source table for criteria to update automatically based on values from other criteria entered. For example: Column A could be Region. Column B could be job. Column C could be Salary Grade. I would like, should I choose East Region, for the list of possible jobs to be then updated automatically to exclude any jobs that are ...

distributing data into multiple cells
hii i have to prepare an exel sheet of some 2000 products..i have to copy d data from the net and then prepare the sheet,with 4 different columns for 4 diff types of entries..now when i copy data nad paste is as text.it all goes in a single cell in a row .how can i distribute the data l into multiple cells????????? -- jaspreet ------------------------------------------------------------------------ jaspreet's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23821 View this thread: http://www.excelforum.com/showthread.php?threadid=374772 can you show some samp...

Is there a way to sort multiple columns with a tab or something?
I have a 4 column spreadsheet. I want to be able to click the heading for each of the columns to hav them sort by that column if clicked. How do I do that -- Message posted from http://www.ExcelForum.com Hi why not used the soprt icon for this. Note: This could screw up your sorting if Excel does not recognize your database columns correctly -- Regards Frank Kabel Frankfurt, Germany > I have a 4 column spreadsheet. > > I want to be able to click the heading for each of the columns to have > them sort by that column if clicked. How do I do that? > > > --- > Mess...

Sending to multiple addresses
How do I send an email to multiple addresses having only the recipient see their own email address? Michelle wrote: > How do I send an email to multiple addresses having only > the recipient see their own email address? Put the addresses into the BCC: field. Note that many e-mail programs will decide such mails are spam though. >-----Original Message----- >How do I send an email to multiple addresses having only >the recipient see their own email address? >. Open your new email and go to tools, select recipient, when your address book opens select (highlight) the a...

Need help building query
I'm not that familiar to Access and would appreciate some help building the following SQL query. I have two tables, and if two categories match within the tables, then I would like a third category entry updated to the first table. 1st Table: Working 2nd Table: Original Categories (columns) that should match between table 1 and 2: Pt Acct # Charge Cd If the entires for a line match, then update: Lawson # (take from Original table and enter into line for Working table) So, basically if the (Pt Acct #) AND (Charge Cd) in the (Original) table match the (Pt Acct #) AND (Charge Cd) in...

Exchange 2000 Distribution Lists
Hello We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5 Is there any way to configure multiple people to be owners or editors of the distribution lists? This was possible in 5.5, but we cannot find a means of accomplishing this in 2000 Any help would be appreciated Thank yo Jason "Jason P.S." <jason.pruden-shebaylo@investorsgroup.com> wrote: >We are running an Exchange 2000 environment in Exchange Native Mode and Windows Mixed Mode. We just converted from Exchange 5.5. > >Is there any w...

multiple selection
How can I select multiple records into a list box? I want that for append identical records (for select records) in another table. Many thanks Florin Use a subform instead of a list box. In a subform bound to a related table, you can append as many rows as applicable. It is possible (but not simple) to use an unbound multi-select list box that is populated in the Current event of the form, and executes Append, Delete, and Update query statements based on the ItemsSelected if they are changed. You will also have to find a way to respond to the user "undoing" changes. -- Al...

Need to have a dropdown list containing multiple rows
I am setting up an form and need to create a dropdown list that will contain 8 sets of data. Each set needs to contain 3 rows of data (name, street address & city/state/zip. The goal is to allow the user to click onto the cell, see the dropdown and select which address set to use. This would then place the data into three rows suitable for mailing. I have never attempted anything like this and am in need of assistance. Thank you. --- Message posted from http://www.ExcelForum.com/ Pat What you ask is easily done using Data Validation drop-down list and a few Vlookups but........Ex...

Multiple domains #6
Hi, Having done some research I have found that it is possible to send and receive email from multiple domains with Exchange 2003. I have a few questions that I would like cleared up if anyone can help. 1. Is it really as simple as configuring a recipient policy for the new domain and then changing the mail record for that domain to point to the proper IP address? 2. If I set up a new account in AD, and need this account to be associated with the second email domain, will the default SMTP email be for the first domain? If so, can I just edit this directly? 3. If I set the default SMTP add...

Combine multiple tables into one
I took over a database in which the last person created a new table for everyday worth of data (ie. Feb-21-08 is named 022108). There are over 100 tables in the single database with the same columns and table attributes, I would like to combine all of these tables into one where I have a Date_Key field in place of the table name. I figured out how to query the table names using the following: SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") AND (Left$([Name],4) <> "Msys") AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name; Now I j...

forwarding mail to multiple external addresses
I have a user on our Exchange Server 2003 that wants his email to be forwarded to 2 different external email addresses and not have the original mail stored in his exchange mailbox at all. I can set this up to froward to only one external email address by creating a contact in Active Directory with an external email address and then forwarding to that contact. However, it won't allow me to forward to multiple contacts. Please help as this seems like a pretty common request from several users. I'm not sure, as I haven't tested it before, but you might be able to create a ...

Help Regarding an update query
Hi, iam trying to run an update query. the situation is as follows, i have linked excel sheets in my table. so i am using the update query to update all the records that i have them in my access tables. i tried this before many times and i was successful in doing that. But in some tables, it gave me an error message "Type mismatch in expression". i checked each and every field in my access table and in the excel sheets and they are all with the correct format. any help?? any ideas? On Fri, 31 Aug 2007 08:47:16 -0700, Samer <samoora44@gmail.com> wrote: >Hi, iam trying to r...

Finding Data in multiple worksheets
Using Excel 2000, how can I find data in multiple worksheets; example: any number between 200 & 299 in 32 worksheets? If you mean you want to find a single number across 32 worksheets, group your worksheets (click on the first, ctrl-click on subsequent (or even shift-click)). Then Edit|Find But I think I'd use Jan Karel Pieterse's FlexFind: http://www.oaltd.co.uk/MVP/ If you meant you wanted to find all 100 numbers (200-299) in all 32 sheets, then I think I'd have a macro search for each number and report the results on a new worksheet. "mark@southwestconst.com&quo...

Update Query in VBA
Hello, I am using Access 2003. I am trying to run an update query through VBA. My SQL is this: UPDATE CostSummarySheet SET CostSummarySheet.Active = Forms!fsubLOA!Active WHERE (((CostSummarySheet.Proj_Name)=[Forms]![frmCSSheetEdit]![Proj_Name])); and the code I am attempting to use is this: Dim db As DAO.Database Dim strSql As String strSql = "UPDATE CostSummarySheet SET [Active] = [Forms]![frmCSSheetEdit]![fsubLOA]![Active] WHERE [Proj_Name]= [Forms]![frmCSSheetEdit]![Proj_Name];" Set db = DBEngine(0)(0) db.Execute strSql, dbFailOnError ...

show multiple values that add to total in bar graph
Is there a way to show multiple values in a single bar (in a bar graph) that add up to a total (example: 127, 129, 87, 85, 60, 126, 89 add up to 703)? I want a sigle bar that goes to 703 but breaks the single bar down into these segments (preferrably by color showing the smaller segment amounts within the color. HELP!!!! Thanks! Hi, Is that not what the stacked column chart does? Cheers Andy Green Goose 89 wrote: > Is there a way to show multiple values in a single bar (in a bar graph) that > add up to a total (example: 127, 129, 87, 85, 60, 126, 89 add up to 703)? I > want...