Google Answers Logo
View Question
 
Q: MS Access Query ( No Answer,   3 Comments )
Question  
Subject: MS Access Query
Category: Computers > Algorithms
Asked by: clint34-ga
List Price: $20.00
Posted: 07 Oct 2005 06:21 PDT
Expires: 06 Nov 2005 05:21 PST
Question ID: 577495
I have a database,which contains names and address of homes and homeowners.

I can run a query to get general results: e.g.
pull from lstOwner table and give me name, address, city, state, zip of owner.
pull in same query, from tblbaseparcel table, gives me street number,
street name, and landtype.

From the results I can sort, of course, many different ways; all
residential, all by state, all by owner, etc.

I would like to solve this dilemna;

I would like to take the data, given in the query, and refine it.

for example I have an owner of several homes, with the same mailing
address and different address of homes he owns, for simplicity sake, i
have illustrated below.

         john smith, 123 main st, city, state, zip, 123, main, res
         john smith, 123 main st, city, state, zip, 217, sunset, res
         john smith, 123 main st, city, state, zip, 1476 waterway, res 
         john smith, 123 main st, city, state, zip, 9875 beauregard, res
         mary smith, 89 peac maker, city, state, zip, 89, peacemaker, res


I would like to query, refine, whatever its called so that I end up with:
          
          john smith, 123 main st, city, state, zip, res
                      217, sunset
                      147, waterway
                      9875, bearegaurd
          mary smith, 89 peacemaker, city, state, zip, res

It doesn't have to be columnized, like was illustrated, but, could be
in a tabular row format as well; eg
john smith, 123 main st, city, state, zip, 217, sunset, 147, waterway,
9875 beauregard
mary smith, 89 peacemaker, city, state, zip, 

etc. etc.

this has been driving me to the point of Google Answers!  Help ;-)

Clint
Answer  
There is no answer at this time.

Comments  
Subject: Re: MS Access Query
From: stevenp-ga on 08 Oct 2005 08:48 PDT
 
Instead of making another query, make a report based on an existing
query.  This should solve the problem.  Are you familiar with reports?
 If not, here are some instructions.

I would use the wizard to get familiar with reports.

1) When you open Access, a box appears. Click on "Reports" on the far
left side of the box.
2) Double click on "Create report by using wizard"
3) Select the query and the fields you're interested in using and click "Next"
4) The next screen will ask you how you want to view your data.  You
should select "by [name]".  The field [name] corresponds to whatever
you have called the field that contains the name of the property
owner.
5) Click "Next" 
6) Skip the next screen for now.  You don't need to add additional
groupings, but later you may want to.  This would allow you to group
by things in addition to name, e.g. city.  Click "Next"
7) Choose which fields you want to sort by and click "Next"
8) Choose the layout you want.  Based on what you wrote, I would
choose "Stepped" or "Blocked".  Click "Next"
9) Choose the style you like and click "Next"
10) Give the report a name and click "Finish"

You will want to play around with this.  Once the report is made, you
can make a lot of changes if you switch to design view.  You may want
to do some reading on reports.

This should solve your problem.  Good luck.
Subject: Re: MS Access Query
From: nejla-ga on 26 Oct 2005 13:39 PDT
 
You didn't explained the detail information about the structure of
your tables. But according to what I understod from your note, your
problem can simply be solved with a simple 1-n relationship.
So for doing that:
1) your table structures should look like bellow:
   Make Table "lstOwner" with the following fields:
   OwnerId, Name, Address, City, State, Zip
2) Make field "OwnerId" of the "lstOwner" table the primary key of the tbale.
3) Make Table "tblbaseparcel" with the following fields:
   OwnerId,StreetNumber, StreetName,LandType
4. Make the combination of OwnerId, and StreetNumber or another
field(s) as your primary key.
   Note: The primary key should be unique, so if one owner could be
the owner of more than one place at the same Street, you should add
other fields to the primary key fields group.
5. make a relationship between these two tables on the field of
"OwnerId". In other words make the field "OwnerId" of the
"tblbaseparcel" as its foreign key.
6. Now You can write a simple query like bellow:
    SELECT O.Name, O.Address, O.City, O.State, O.Zip, 
           P.StreetNumber, P.StreetName, P.LandType
    FROM lstOwner O, tblbaseparcel P 
    WHERE O.OwnerId = P.OwnerId
    ORDER BY O.Name

This works on access.

You can write your code in other way too:

    SELECT O.Name, O.Address, O.City, O.State, O.Zip, 
           P.StreetNumber, P.StreetName, P.LandType
    FROM lstOwner O LEFT OUTER JOIN tblbaseparcel P  ON O.OwnerId = P.OwnerId
    ORDER BY O.Name

This should solve your problem
Good Luck
Nejla
Subject: Re: MS Access Query
From: clint34-ga on 26 Oct 2005 16:39 PDT
 
Thanks for both of your suggestions.  I will put them to work at once.

Clint

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy