Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Query from 3 tables

 
   Windows Help (Home) -> Microsoft Access RSS
Next:  MS Word 2000 compatibility with Windows 7  
Author Message
exebat

External


Since: Dec 8, 2009
Posts: 4



(Msg. 1) Posted: Tue Dec 08, 2009 11:41 am
Post subject: Query from 3 tables
Archived from groups: microsoft>public>access (more info?)

I have three tables that I want to put in query. But this is what I
need:


Articles Stores MinimumQTY
----------- ----------
---------------------
ArticleID StoreID ArticleID
ArticleName StoreName StoreID
ArticlePrice MinQTY
OptimalQTY

What I would like is to have a query that shows all recors from
Articles, and for each article to show all Stores and for each StoreID
to show records in MinimumQTY. This seems like easy task but I want to
be able to enter quantities for each store directly in query. I mean
it should show every StoreID even if it doesnt have related record in
MinimumQTY.

It should be like this:

ArticleID
1001
StoreID MinQTY OptimalQTY
1 2 5
2
3 2 5
4
5
ArticleID
1002
StoreID MinQTY OptimalQTY
1
2 4 10
3
4
5

If I could have this I could simply enter MinQTY for ArticleID and
StoreID in query to be for example 5.


Any help ?


Thanks in advance.

 >> Stay informed about: Query from 3 tables 
Back to top
Login to vote
Daryl S

External


Since: Oct 19, 2009
Posts: 13



(Msg. 2) Posted: Thu Dec 10, 2009 10:19 am
Post subject: RE: Query from 3 tables
Archived from groups: per prev. post (more info?)

Exebat -

You are asking to do two types of queries in one - an update for records
that are there, and an append for new records. You can't do that in one
query. This approach might work for you:

If you really should have all articles at all stores, then run an append
query to populate the MinimumQty table with all StoreID / ArticleID
combinations that are not there. Then you can run a query that will show you
what you want on a form (use Datasheet Mode to make entry easiest).

If you do not want all articles at all stores, then you need to decide what
the trade-off is of showing the possibilities. You can also take the
approach above, followed by a delete query that will remove all records with
no MinQty and no OptimalQty.

 >> Stay informed about: Query from 3 tables 
Back to top
Login to vote
Douglas J. Steele

External


Since: Nov 27, 2008
Posts: 61



(Msg. 3) Posted: Thu Dec 10, 2009 1:36 pm
Post subject: Re: Query from 3 tables
Archived from groups: per prev. post (more info?)

"Daryl S" wrote in message

> Exebat -
>
> You are asking to do two types of queries in one - an update for records
> that are there, and an append for new records. You can't do that in one
> query.

Actually, you can.

See my November, 2003 "Access Answers" column in Pinnacle Publication's
"Smart Access". You can download the column (and sample database) for free
at [URL="http://www.accessmvp.com/DJSteele/SmartAccess.html"]http://www.accessmvp.com/DJSteele/SmartAccess.html[/URL]
 >> Stay informed about: Query from 3 tables 
Back to top
Login to vote
Daryl S

External


Since: Oct 19, 2009
Posts: 13



(Msg. 4) Posted: Fri Dec 11, 2009 7:11 am
Post subject: Re: Query from 3 tables
Archived from groups: per prev. post (more info?)

Douglas - your code requires the 'new data', which in Exabat's case will
require a cartesian product query, as there is no 'new data' table in this
case. So we are back to two queries in either case, though with your method
you would only need to run one of them, the other would be needed as the 'new
data' source. In either case, if all the records are needed (i.e. all
articles should be in all stores), then this is OK, otherwise there will be
some cleanup to do.
 >> Stay informed about: Query from 3 tables 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Can not change data once i bases a query on a query - I have a despatch System that shows a customers orders with the products to be despatched Its on a Contious form based on a query. On the form i also want to show the Quantity that need to be despatched as the order might be despated in parts Th I hav...

Tables Disappeared - Access2003 on XPproSP2. All of the tables and queries in my database have suddenly disappeared, but the forms can still see the data. I've tried closing and repairing, I've tried importing into a new database - the forms and reports can be imported bu...

I'm cryin' here -- please help with pivot tables - I posted the following message yesterday, but got no responses. I'm an infrequent Access user, but I've become so dependent on this group for help when I get stuck. Can anyone give me a little insight? Thanks so much!!! JoLeigh I've been creating..

Simultaneously create records in multiple tables - I'm creating a project database for my company in access. We use a specific Project Number for each of our projects (i.e. 09-01-100). Each project has so much information that I actually used all the fields in my first table! It has expanded to four..

swap tables when more than one table is linked to primary .. - I am using office 2007 and have linked a few tables to my primary master table, and is working fine. Only problem is, that now I need to swap back to a previious table that is still linked to the primary table, and i cant seem to find any where on my...
   Windows Help (Home) -> Microsoft Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]