Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-16-2005, 03:48 PM   #1
Member (9 bit)
 
Join Date: Nov 2002
Posts: 502
MS Access 2003 Query

I need to create a DB that controls the inventory, so I created two tables one for the entries and one for the issues, but now I can`t create a query that join the two tables as one and make the rest because if an Item that has an entry in the table of entries but has not movements in the table of issues, the query doesn`t include the item for example if I have 20 item of x product but I haven`t sale no one, the item is not included in the query and if I sale a product that has no entry in the table of entries the item is not included in the query, is there a way to qet a query to work in this escenario?

Last edited by easg; 05-16-2005 at 03:51 PM.
easg is offline   Reply With Quote
Old 05-16-2005, 04:12 PM   #2
Member (11 bit)
 
sdkfz's Avatar
 
Join Date: Dec 2001
Location: Shakopee MN
Posts: 1,293
Not exactly sure of what you need here, but to get the wheels going....

In the query when you have it in desgin view the two tables should be linked by a common denominator - say 'item inventory control number'. Now when the two are linked the default connection is 'show me records in both tables where there is a common item in both tables', but you can change this by right clicking on the connector line, the other two options are give me all of table X and related records in Y and vice versa. In each of these cases you get the entire table and anything found in the other, so in the inventory table as 'all of' you would get all the rows of data for the fields selected from that table and if there were any sales - then the data for the fields you select from the sales table.

or am I way off base here?
__________________
Never Argue With An Idiot. They'll Drag You Down To Their Level And Then Beat You With Experience.
sdkfz is offline   Reply With Quote
Old 05-16-2005, 05:19 PM   #3
Member (9 bit)
 
Join Date: Nov 2002
Posts: 502
It didn`t work, now it duplicates the values, if there is one entry of 10 for x item and there are 2 exits of 3 it duplicates the entrie of 10 and sums 20
easg is offline   Reply With Quote
Old 05-17-2005, 08:22 AM   #4
Come in Ray...
 
faulkner132's Avatar
 
Join Date: Sep 2004
Posts: 1,668
I have never used the Access query wizard, but you can accomplish what you need to by using LEFT JOIN.

When you create your "link" between tables, instead of using JOIN or INNER JOIN, use LEFT JOIN instead. This will bring over everything from the FROM table and only matching items in the JOIN table.

It's a bit hard to explain, but a simple Google search will produce better explainations than mine. This should get you started though.
faulkner132 is offline   Reply With Quote
Old 05-17-2005, 09:20 AM   #5
Member (11 bit)
 
sdkfz's Avatar
 
Join Date: Dec 2001
Location: Shakopee MN
Posts: 1,293
faulkner - the left join is what I gave easg which they claim is not what they are looking for....

easg - since we (I) are/am not getting it - would you mind trying to restate the question? also could you post the SQL statement of the query that you have now? To do this in design view - go to the menu bar and select view and choose SQL view, then you can copy and paste the text out- this does not harm the query and you can go back to the mnue bar and change the view back
sdkfz is offline   Reply With Quote
Old 05-17-2005, 09:26 AM   #6
Member (8 bit)
 
rcvalencia9's Avatar
 
Join Date: Oct 2004
Location: Manila, Philippines
Posts: 221
Are you sure you created a Foreign Key this will be important when you use the JOIN clause. A good foreign key is [Item Category] if you're selling products.

Important Note: When you connect two tables using query, Table 1.Foreign key has at least a match in the 2nd Table. For Example in your first table you have 20 Asus P5GD1 MOBOS and the the [Item Category] of each item is "Motherboards". The data "Motherboards" under the [Item Category] should also exist in the 2nd Table to create a query.
rcvalencia9 is offline   Reply With Quote
Old 05-17-2005, 09:52 AM   #7
Member (9 bit)
 
Join Date: Nov 2002
Posts: 502
SELECT [Detalle Entradas Almacen].ID_Articulo, Sum([Detalle Entradas Almacen].Cantidad) AS SumaDeCantidad, Sum([Detalle equipos reparados].Und) AS SumaDeUnd
FROM ([Catalogo de Articulos] INNER JOIN [Detalle Entradas Almacen] ON [Catalogo de Articulos].Id_Articulos = [Detalle Entradas Almacen].ID_Articulo) INNER JOIN [Detalle equipos reparados] ON [Catalogo de Articulos].Id_Articulos = [Detalle equipos reparados].Id_Articulo
GROUP BY [Detalle Entradas Almacen].ID_Articulo;

This is the sql view of the query, and there is an attach with a general view of the relationships of the db, what I want is a tipical inventory report etries exits and difference, but it only takes in count the movements that has registries in the two tables, if I change the Join config it duplicates the values of the item to fill empty spaces, thus creating duplicated movements.
Attached Images
File Type: jpg Nueva imagen.jpg (32.2 KB, 151 views)
easg is offline   Reply With Quote
Old 05-17-2005, 02:20 PM   #8
Member (10 bit)
 
Join Date: Jun 2000
Location: Dorset UK
Posts: 559
I found this particular website to be an excellent information area for access problems etc.

http://www.utteraccess.com/

Doug
DougL is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:23 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2